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

linking fields on a form

Status
Not open for further replies.

erich13us

MIS
Feb 12, 2003
16
US
I have a form that uses City, State and Zip Code as Combo boxes. They all use the same lookup table. After I enter the city, I want the corresponding Zip Code to be entered in the ZipCode Field.
 
In the query that populates the "City" combo have the state and zip fields as columns 3 & 4.
After you have selected city in the After_Update event of the combo write:

Me.ComboState = Me.ComboCity.Column(2)
Me.ComboZip = Me.ComboCity.Column(3)

The count for columns in a combo starts from zero!
 
I can't get it to work. The data is coming from a table not a query. Would that be the cause? The columns in the table are City, State, Zip and CS Cachment. Also, it dosen't seem to like the use of the word "combo".

Erich
 
Using a table doesn't change the situation but you lose some of the facilities of sorting etc...

The expression Me.ComboState is meant to refer to the name of the combo in which you want the State data - this could be Me.Item26 or whatever - you need to look in the proerty page to find the name of the control.........this applies to all of the controls referred to:
.....State
.....City
.....Zip
 
send me your email and I will send you a sample of how to do what you wish.

rollie@bwsys.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top