Looking to use VBA code to back-fill city and state from a zip code. For the main table, I have peLoc1Zip (short text), peLoc1City, peLoc1State. All short text.
In the table 'zips' I have an autonumber, Zip, City, State - All are short text.
This is what I've tried so far:
=============== ==========
=============== =============== =
Second part of the problem is there are some zipcodes that have multiple towns. For instance, my Town (Southbridge) is also listed as Globe Village, Sandersdale, Southbridge, Southbridge Center, W Dudley, West Dudley (sorry just copy and pasted the results). To handle this, I would like to have a combo box populated with the results of the zipcode.
I'm at a complete loss and would appreciate some help. Thanks in advance!
Alan
In the table 'zips' I have an autonumber, Zip, City, State - All are short text.
This is what I've tried so far:
=============== ==========
Code:
Private Sub peLoc1Zip_AfterUpdate() Zip = "'" & Me.peLoc1Zip & "'" peLoc1City = DLookup("City", "Zips", "Zip = " & Me.peLoc1Zip) peloc1State = DLookup("State", "Zips", "Zip = " & Me.peLoc1Zip) End Sub
Second part of the problem is there are some zipcodes that have multiple towns. For instance, my Town (Southbridge) is also listed as Globe Village, Sandersdale, Southbridge, Southbridge Center, W Dudley, West Dudley (sorry just copy and pasted the results). To handle this, I would like to have a combo box populated with the results of the zipcode.
I'm at a complete loss and would appreciate some help. Thanks in advance!
Alan
Comment