Display data in form based on dropdown list

S

sfleck

I have a table or a query that i would like to control what is displayed on
the form by a dropdown list but am having a brain freeze on how to best to
accomplish that
 
S

sfleck

Thank you for the link. As with most things now that know this I would like
to expand the functionality...

If the search return multiple records can I display them alltogether?
 
O

Ofer Cohen

For that you can try another method:
********************************
You can use a Main Form that contain the combo, and Sub Form to list all the
records that match the selection.

In the RecordSource of the SubForm you can create a reference to the combo
in the main form

Select * From TableName Where FieldName = Forms![MainFormName]![ComboName]

***************************
If you want all the records to return if no value was selected in the combo,
then add another criteria to the RecordSource of the SubForm

Select * From TableName Where FieldName = Forms![MainFormName]![ComboName]
Or Forms![MainFormName]![ComboName] Is Null
***************************
On the AfterUpdate event of the combo run the code
Me.[SubFormControlName].Requery

To refresh the list of data in the SubForm
***************************
 
Top