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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update a combo box on a sub-form 2

Status
Not open for further replies.

RDS2

Technical User
Jun 6, 2003
44
US
I have a form with a sub-form. The sub-form has a combo box whose drop down list is based on a query. The query has criteria based on a field in the main form. The combo box will display correct list items for the first pass through the form and subform. After that the query will not update the combo box list. I've tried requerying (with event procedures)almost all available events but the combo box list contents does not change. Any ideas would be greatly appreciated.
 
can you post the combo's rowsource query? Can you post the code you used to requery the combobox?

To test that it is a requery problem. Change the data in the main form and then manually open the query that the combo is based on. Does this show the correct data?
 
how are ya RDS2 . . .
RDS2 said:
[blue]The combo box will display correct list items for [purple]the first pass[/purple] through the form and subform.[/blue]
[purple]Be more specific about this![/purple] . . .

Calvin.gif
See Ya! . . . . . .
 
AceMan:

I guess my description could have been... more descriptive. When I use "first pass" I mean the following:
(1) when the form (a tabbed form) is initially loaded I can scroll through records and as the control on the main form displays the field used for criteria in the combo box (on the sub form and 2nd tab) changes -- the underlyinhg query performs as intended. That is if I select the combo box on the sub form it displays the correct subset of records.
(2) If I now go back to the main form and scroll through some records (thereby changing the query criteria), go back to the sub-form, click the combo box the same list appears that was produced the first time. The list has not been updated.
I believe that a Requery associated with an event should fire the query before reloading the combo box list. I have been unable to produce this result.
 
RDS2 . . .

In the OnCurrent event of the MainForm:
Code:
[blue]Forms![purple][b]MainFormName[/b][/purple]![purple][b]subFormName[/b][/purple].Form![purple][b]ComboboxName[/b][/purple].Requery[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks to all respondents. AceMan1 ... thanks for the code!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top