kb1pwr:
1)Please format you script using the
[CODE/] button.
2)Respectfully, normally, only one topic per thread will be addressed, this is a site/thread requirement:
3)You've not told us what is wrong with your code, version of office/access
4)Normalizing your database will help you with both aspects of your question(s):
> Database Normalization and Table Structures.
Because you've left some details out, such as (3), I'll offer you some advice to consider:
A properly normalized database will not store the same information in multiple tables unless there is a need for auditing or other special cases.
IMHO: What you should consider is the following database scheme:=
tbl_zipcode
[zipcode_pk] autonumber
[zipcode_main] text(20)
One might be tempted to use the zipcode as a primary key as it shouldn't be repeated. So long as you are dealing with the USA that will hold true for the forseeable; however, if you need to add Canada or other contries then you're in trouble as these are not numerics and numerics are easier and faster.
Tbl_State
[state_pk]autonumber
[state_fullname] text(25)
[state_abrv] text(5)
Should be obvious.
Tbl_City
[City_pk]autonumber
[City_name]text(50)
Now you can either use these as foriegn keys in an addressbook type table or do the following:
tbl_cityloc
[cityloc_pk] autonumber
[cityloc_FK_city] numeric(long)1:m with tbl_city
[cityloc_FK_state] numeric(long)1:m with tbl_state
[cityloc_FK_zipcode] numeric(long)1:m with tbl_zipcode
Now you would only use the [cityloc_pk] to refer say, Los Vegas, NV; or Greenville, AL; Greenville, AK; etc... instead of repeating the information a ton of times.
Once you have this tbl_cityloc, you can build a query that has that pulls the stuff from the related tables for a nice human readable text and yet the value of the control is just the [cityloc_pk]... you can also build cascading comboboxes and other filters that will make your searches easier.
Now this is just one way to do what I think you are after.
If you are a very new user to Access, VBA, database design, please let me know and I'll pm you a list of tutorials and references that will help you get out the kiddie pool and into the deepend in fairly quick time.