main form txt to filter subform combo box

Jaymin

Registered User.
Local time
Tomorrow, 01:24
Joined
Oct 24, 2011
Messages
70
A Newbee needs help,
I have a main form with a txt box that gets data from another form, I want this data to then be able to filter the results in the combo box in the subform.
Eg the first form by way of combo box gives me data of a "town name", this is picked up by the main form txt box, and the combo box is now filtered, and gets a list of "people names" pertaining to that town.
It seems quite simple but for the like of me I cannot figure it out, the closest i get is to populate the combo box with all the names, and have not found any solution on the net to help me, that I can understand.
looking for help please
Peter :confused:
 
I'm guessing the subform is in Datasheet view or is a Continuous form?
 
vbaInet,
Thank you for you reply, no i am trying to have it as a single form
Peter
 
So the scenario is:

1. Textbox on main form gets "town name" from another form
2. Combo box looks this up and filters by "town name"

Is the above correct?
 
Is the Row Source of your combo box based on a query? If it isn't it will need to be.

Once you've done that, under the Criteria row of the field you will like to filter by in the query, put the full path to your textbox, i.e.
Code:
[Forms]![[COLOR=Red]FormName[/COLOR]]![[COLOR=Red]ComboBoxName[/COLOR]]
Amend the red bits.

In the After Update event of the textbox put this:
Code:
Me.[COLOR=Red]ComboBoxName[/COLOR].Requiry
 
vbaInet,
I had a bit of trouble with the process, but with your great help I have finally got it working.
Many thank for your time and effort
Peter ;)
 

Users who are viewing this thread

Back
Top Bottom