How to create forms with multiple selection

  • Thread starter Thread starter hylow
  • Start date Start date
H

hylow

Hi there,

I've successfully created a main form with a subform, for single
selection - select something in the main form and the related records
appear in the subform. This is as good as a query.

Now I need to add more than 1 selection combo boxes in the main form,
but I couldn't get the subform showing the relevent records.

I've used to use 2 tables with a link for the 1 selection test, but
not sure how to do it with multiple selection?

Waiting for advice ... many thanks!
 
I've used to use 2 tables with a link for the 1 selection test, but
not sure how to do it with multiple selection?

The Master Link Field and Child Link Field properties can have up to
*ten* fields, separated by semicolons. And although it's not offered
by the wizard, you can use the names of Controls (e.g. combo boxes) in
the Master Link Field to link to fields in the subform's recordsource.

For example, you could have Master/Child:

[cboSite];[cboDepartment];[cboProduct]
SiteID;DepartmentID;ProductID


John W. Vinson[MVP]
(no longer chatting for now)
 
John,

Thanks, and I have the 3 combo boxes working now in the main form!

These 3 combos each specify a criteria and the selection is limited to
the previous selection choice. However every time I call up the form
the 3 combos will show the previous value I selected. How can I make
it show something 'blank' when I first call up the form?

Also, I would like to create a 'Search' button, which ensures the
subform only runs when it is pressed. Currently my subform is changing
every time I change a selection in the main form. However I want both
the main and sub forms to appear on the same screen though.

Thanks.

HY
 
How can I make
it show something 'blank' when I first call up the form?

Use the Form's Current event to set each combo box to NULL.
Also, I would like to create a 'Search' button, which ensures the
subform only runs when it is pressed. Currently my subform is changing
every time I change a selection in the main form. However I want both
the main and sub forms to appear on the same screen though.

Hm. You may not be able to have it both ways! If you want a Subform,
all I can suggest is that you set the subform's Visible property to
False (both in design view and in the form's Current event), and set
it to True in the click event of the button.

John W. Vinson[MVP]
(no longer chatting for now)
 
I found a way to do the first one - ensuring there's no Default value
specified for the combos.

I don't see Visibility in the form's property box?

I am creating a search functionality here, is there any better way to
do it apart from the subform method? The user needs to enter a few
criteria through the combo boxes, and the corresponding records need
to appear when the 'Search' button is pressed.

And when user initiates another search (through changing any of the
selections in the 3 combo boxes) the records based on previous search
shown should either remains until the 'Search' button is pressed
again, or disappear automatically.

Thanks.

HY
 
Back
Top