Using Combo Box to select records for subform

Johnny Drama

In need of beer...
Local time
Yesterday, 18:16
Joined
Dec 12, 2008
Messages
211
Hello all,

I looked to see if this was answered prior, but I couldn't find anything on it.

I have a form with an unbound combo box and then a subform. I want to be able to select a value in the combo box and have the subform pull up the associated value and description in the subform.

Example:

tblOne has a field named ControlNumber (primary key, one)
tblTwo has fields named ControlNumber (foreign key, many), Description, Date, Name.

The form contains the unbound combo box which is populated using tblOne.ControlNumber and the subform has all of the fields from tblTwo. When I select the ControlNumber in the combobox I would like the subform to show all of the records associated with only that controlnumber.

Thoughts?
 
In your subform query, add criteria to the ContronNumber column for the value of the combo box, something like [Forms]![YourMainForm].[YourComboBox].[Value]. When the afterupdate event requeries the subform, it should only return what you are looking for.
 
I'm not sure what the [value] criteria is supposed to be in the example you provided? Can you clarify for me?

Thanks
 
Nevermind....figured it out! Just had to give the hamsters more cheese so they'd turn the wheel in my head a little quicker...

Thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom