lookup using combo and text box

Nitesh9999

Nitesh9999
Local time
Today, 23:32
Joined
Mar 16, 2005
Messages
42
Hey guys

This is the problem,

I have 2 fields in a table. Cityand Country.

City Country

paris.......France
madrid....Spain
london....England
milan.....Italy
Rome.....Italy
ETC

Field "City" is connected to a combo box and field "country" to a textbox on the form.

I would like the user to select a city from the combo box. When this is done the textbox linked to the country field should automatically update to show the correct country. This should update without user intervention.

I would find it better to have the text box look up a value list rather than use a table for its source. the form is being used as data entry. The combobox linked to field "city" is also a value list.

Thanks in advance.
Nitesh
 
City Country

Please search the forum.
There are many posts since this question is being asked almost daily.
 
I did that but tried again anyway and i somehow stumbled accross the problem i was having. I didnt know you could set multiple coloumn widths, in comboboxes.

Thanks.
 
check this thread , there is a good sample database how you should auto fill your textbox.
 
Nitesh9999 said:
This is the problem,

I have 2 fields in a table. Cityand Country.

Those two fields in the one table are the problem. This should be a one to many relationship as one country can have many cities. Therefore, you need two tables - one for cities and one for countries.

ie.

tblCountries
CountryID - Autonumber
Country - Text

tblCities
CityID - Autonumber
City - Text
CountryID - Number

Relate the CountryID of each table.
 
Thanks for that guys.

Sorry if i wasn't clear but i managed to solve the problem.

PS i know about the one to many relationship. It was just that i was trying to put my query accross in an understandable manner.

Thanks again

Nitesh
 

Users who are viewing this thread

Back
Top Bottom