Quote:
Originally Posted by inepu
I have some excel sheets that I would like to manage in access. I've created the access tables and relationships; the excel sheet is only one table and with duplicate data, I'd like to make sure that when I import the sheet, the proper tables are filled correctly.
For example, the excel sheet is in the format
clientID Name phone City Country
In acces, I have a "Cities" table and a "Coutries" table, with the fields (e.g. for cities)
ID (primary key)
City (non duplicable)
The Clientes table is something like
ClientID Name phone cityId CountryId
and I would like the Clients, Cities and Coutries tables to be filled correctly, with the Clients' cityID and CountryID pointing to the right fields
I've followed this topic http://www.thescripts.com/forum/thread190306.html but I can't get it to work. In the end, when I try to execute the query, i get "You have chosen to add 0 rows etc etc" and It doesn't add anything to the db.
Thanks in advance
When importing Excel data into Access, the easy way is to link a table to the excel sheet.
Next use Maketable or Append queries to fill your tables.
Using an ID for City and Country will make your imports harder, I would just use a table with "City" and "Country".
But when you want such an ID then first use an append query to add the distinct cities like:
-
select into tblCity (City) select distinct city from tblExcel
-
Next create a query that joins the tblExcel by the City and use the CityID field instead of the city. Now you can use that query to append the tblClients.
(Ofcourse the same mechanism can be used for the Countries).
Getting the idea ?
Nic;o)