G
Guest
I have a table named "Zipcodes" with two fields: City and Zip
On my main form, I have a control named "City" with a drop down list box
that derives its contents from the "City" field of the "Zipcodes Table".
After I select the City from the dropdown list, I would like Access to
insert the corresponding zipcode (found in the Zip field of the Zipcodes
Table) in a control on my form named "Zipcode". I assume that if that
zipcode field on my form is bound to my primary table that stores all the
data entered on the form, the inserted zipcode will also be stored in the
primary table once the record is stored.
I can't figure out how do this. I tried writing a macro that would execute
on "On Change" of the City field of my form (once the city was selected from
the dropdown box). This macro reads as follows:
SET VALUE: [Forms]![Main]![zipcode]
EXPRESSIONLookUp("[Zip]",
![Zipcode],[Table!zipcode!City=[Forms!Main!City)])
I would appreciate your suggestions on the simplest way to do this.
Steve
On my main form, I have a control named "City" with a drop down list box
that derives its contents from the "City" field of the "Zipcodes Table".
After I select the City from the dropdown list, I would like Access to
insert the corresponding zipcode (found in the Zip field of the Zipcodes
Table) in a control on my form named "Zipcode". I assume that if that
zipcode field on my form is bound to my primary table that stores all the
data entered on the form, the inserted zipcode will also be stored in the
primary table once the record is stored.
I can't figure out how do this. I tried writing a macro that would execute
on "On Change" of the City field of my form (once the city was selected from
the dropdown box). This macro reads as follows:
SET VALUE: [Forms]![Main]![zipcode]
EXPRESSIONLookUp("[Zip]",
I would appreciate your suggestions on the simplest way to do this.
Steve