Re: Filling multiple fields in a form from one combo box looking for values
- From: Rich P <rpng123@xxxxxxx>
- Date: Sun, 11 Jun 2006 01:28:39 GMT
the simplest way to accomplish your goal is to create a parameter based
query and make that the record source for your form. This form will be
a subform for a main form that contains your combobox.
The combobox - which will be located in the main form - will be based on
the table that you want to filter - The recorsource for that combobox
will be that table and use some ID field - a field which
identifies/filters the rows for the desired data - could be a name
field, an alpha-numerice ID field - just some field that would
filter/select the rows you want - the criteria.
To create a parameter query just create a basic query on your desired
table. This table will need to have an ID field of some sort. In the
ID field in the query - in the criteria secion for the ID field you add
something like this:
Forms!yourMainForm!Combo1
Of course, change yourMainForm to the actural name of your main form and
change Combo1 to the actual name of your combobox.
Then, the form that will be the subform, make the recordsource this
query and set this form to Data*** view (from the properties *** for
that form). Go to the form design view - form properties and in the
recordsource field (the first field in the properties *** of the form)
you select the query you just created to be the recordsource. And just
a few more fields down you can set the Default view to be Data***
view. Now save and close this form and go to the design view of your
main form - the form that contains the combobox.
Drag the form you just created - the form that is based on the parameter
query - your subform) into the design view of your main form and drop
that form (subform) into the main form. Now that form is a subform in
the main form.
One more thing you should do is in the combobox on the main form - go to
the click event of the combobox in the properties *** (lower portion
of the property *** for the combobox) Select the Click Event field.
Then click on the button to the right (with the elipse ...). Select
code. In the code window add this piece of code
Me. Requery
that would look like
Private Sub Combobox1_Click()
Me. Requery
End Sub
Now save the main form and open it. Select an ID from the combobox and
your subform should populate with the filtered records.
Rich
*** Sent via Developersdex http://www.developersdex.com ***
.
- Follow-Ups:
- Re: Filling multiple fields in a form from one combo box looking for values
- From: fstenoughsnoopy
- Re: Filling multiple fields in a form from one combo box looking for values
- References:
- Filling multiple fields in a form from one combo box looking for values
- From: fstenoughsnoopy
- Filling multiple fields in a form from one combo box looking for values
- Prev by Date: Re: Too much in front end?
- Next by Date: Re: Splitting up a linked table into smaller tables
- Previous by thread: Filling multiple fields in a form from one combo box looking for values
- Next by thread: Re: Filling multiple fields in a form from one combo box looking for values
- Index(es):