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!

Access - populate combo box based on value of another field 1

Status
Not open for further replies.

Chats

Technical User
Mar 12, 2002
88
GB
In Access (2000), I want to populate a combo box based on the value of another field on the same form. For example, if I have a field called "World Region" and another called "Country", when I select

Region = Europe I want the Country combo box to list countries in Europe

Region = Africa I want the Country combo box to list countries in Africa

What is the easiest way to do this? If possible I'd like to avoid too much complex code as I am handing the database over to somebody else once it is written.

Thanks for your help

 
In the combo box properties, go to data.

Row Source Type = Table/Query

Row Source SELECT [Country Field] FROM [Your Table] WHERE [Region Field] = Me.[Region Combo Box] Order by [Country Field]

Bill
 
Actually... this will probably cause an error on the start of the form... you may need to leave Row source Blank and then update it in the after_update event of the region box something like...

Me![Country Combo].rowsource = "SELECT [Country Field] FROM [Your Table] WHERE [Region Field] = '" & Me.[Region Combo Box] & "' Order by [Country Field]"

Me![Country Combo].requery

Bill
 
Bill,

Thanks - it was the Requery bit I was missing from my own attempts. I have it working now.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top