Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change values in a combo box ina form

Status
Not open for further replies.

yankinsf

Technical User
Sep 25, 2003
15
US
I have a form with a subform.
The main form has an unbound combo text box with a pull down menu.
The link between the form and the subform has already been established.
When certain data in the subform is updated, I would like the combo box value to change from one value to another,when the form is opened the next time. I am told this can be done using an update query on the subform’s underlying table. Problem is I don’t know how to refer the main form’s combo box in the criteria portion of the update query(if that’s the way to go!).
Can I use the subform’s filter property to write what I need it to look for?
I appreciate all the help I can get with this?

Thanks
Sam
 
It sounds like you need to force the combo box to requery its data source. You can force the requery by attaching the following code to the OnGotFocus property of the combo box (which I'm calling cboMyCombo):

me.cboMyCombo.requery

After you've added data in the subform (which I assume is adding data to the table which provides data used in the combo box), the next time you click on the combo box it will re-run its source query and therefore include the new data. Otherwise, the only time the query is run for the combo box is when you first open the form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top