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

update/refresh combo box 1

Status
Not open for further replies.

jozino01

Technical User
Apr 25, 2003
257
CA
hi,
i have three combo boxes - combo0/country, combo2/state, combo4city - populated by queries:

SELECT [MyData].[Country]
FROM MyData
GROUP BY [country];

SELECT MyData.[St-Prv], MyData.Country
FROM MyData
GROUP BY MyData.[St-Prv], MyData.Country
HAVING (((MyData.Country)=[forms]![form1]![combo0]));

SELECT MyData.CITY, MyData.[St-Prv], MyData.[ZIP-Postal], MyData.Country
FROM MyData
WHERE (((MyData.[St-Prv])=[forms]![form1]![combo2]));

i want to update content of combo boxes for state/city based on content of combo box for country/state. right now it works only at start (first time), after that content doesn't change.

thanks
 
You should requery each of the combo boxes in the current event of the form:

Me.Combo2.Requery
 
excellent, thank you.

can i have one more question - i have one subform with record source the following query:

SELECT MyData.CITY, MyData.[St-Prv], MyData.[ZIP-Postal], MyData.Country
FROM MyData
WHERE (((MyData.[St-Prv])=[forms]![form1]![combo2]));

i want the content of this subform populate/change based on content of combo box combo4. right now is always blank.
 
oops, sorry.
this is the correct query

SELECT MyData.CITY, MyData.[ZIP-Postal], MyData.SNOW_PSF, MyData.WIND, MyData.SEISMIC_ZONE, MyData.FROST_LEVEL, MyData.Contact, MyData.Phone_1, MyData.Phone_2, MyData.Note
FROM MyData
WHERE (((MyData.CITY)=[forms]![form1]![combo4]));
 
I suggest that you set the link master field to Combo4 and the link child field to City. The query then should be:

[tt]SELECT MyData.CITY, MyData.[ZIP-Postal], MyData.SNOW_PSF, MyData.WIND, MyData.SEISMIC_ZONE, MyData.FROST_LEVEL, MyData.Contact, MyData.Phone_1, MyData.Phone_2, MyData.Note
FROM MyData[/tt]

You should check that the bound column of the combo has the right data to match city.
 
thanks.
it looks like the following code works properly with the original query.

Private Sub Combo4_Change()
Form2.Requery
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top