Importing data to Access database with lookup tables

adibakale

Board Regular
Joined
Apr 10, 2015
Messages
52
I am fairly new to Access but starting to get the grasp of it.

I am creating an Access database and I need clarification on using lookup tables.

I import an excel file once a week to a temporary table. From there, I append the data to the main tables to seperate the information accordingly. I want to create additional tables - a CityTable and a StateTable. There are hundreds of records that get imported once a week and many Customers have the same City and State, so I would like to avoid repeating this duplicate information for every record.

My question is, When I append the data from the temporary table to the main tables, Would I append the City data to the main table, or to the City Lookup table?

Here is an example of my Customer table:

Primary Key
Account Number
Customer Name
Street
City
State
Zip Code

I would like to create these lookup tables:

tbl City
tbl State

So, when I append my temporary table to my Customer Table, would I append the City information to the Customer Table? Or too the City table? Same question for the State table.

Any help with this would be greatly appreciated.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You'd check if the state/city exist in their respective tables, if not add them.

You'd then add the primary key of the state/city to your customer table.

Fwiw though, I probably wouldn't normalising the cities unless I expected huge amounts in a small amount of cities. If that were the case you may add the state as a foreign key in the city table then simply join the city to the customer to get both
 
Upvote 0
"You'd check if the state/city exist in their respective tables, if not add them"

I created a StateTable and added all the state abbreviations and state names to it before importing the excel file.

For the StateTable, I used the State Abbreviation field for the Primary Key and connected it to the CustomerTable State field.

After importing my excel file, I appended the Customer State to the CustomerTable.

Is this the correct way to do it?

How do I append it in a way that it would check the StateTable and use the StateTable for the source of data?
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,453
Members
448,967
Latest member
grijken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top