Using IF to check value in a table

RenaG

Registered User.
Local time
Today, 01:38
Joined
Mar 29, 2011
Messages
166
I have a ZipCode table:
ID ZipCode City

I have a form that allows the user to enter a zip code. I need to check that zip code against the table above to determine if it is Rural or Urban. I want to write an If statement something like this:
Code:
If form.ZipCode is in ZipCode table Then
   Territory = 'Urban'
Else
   Territory = 'Rural'
EndIf
I don't know how to do this in VBA. Could somebody help me?

TIA,
~RLG
 
You should be lookintg to do one of the following:

* Create a new Territory field in your table

OR

* Create a new numeric Terriotory field in your table which is linked to a Territories table via that field. Go down this route if you're going to have lots of territories.
 
Thanks vbaInet. I went that route. I added a TerritoryID field to the zipcode table and then linked it to the Territory table. I got it working just fine. Thanks for pointing me in that direction!
 

Users who are viewing this thread

Back
Top Bottom