473,789 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Normalize Linked Table with Queries

I have a table in my database that is linked to an excel spreadsheet. I
need to be able to manipulate the data in this linked table so that I
can create smaller normalized tables that work with what I am trying to
do (all data used in my db will come from this one spreadsheet). I am
currently trying to utilize the make-table queries to create the tables

that I need from this data, however I am unsure of how to add foreign
keys to a table so that my data matches up correctly. Does anyone know
of a way to do this? Is there some sort of append query that can be
ran to find entries in one table matching the entries of another table
as the criterion?

Current Tables:

1) Linked Table - WI_TOC with fields AREA, MODEL_NO, OPERATION and
FILE NAME

2) AREA with fields AREA_ID (autonumber primary key) and AREA

3) MODEL_NO with fields MODEL_NO_ID (autonumber primary key) and
MODEL_NO

4) OPERATION with fields OPERATION_ID (autonumber primary key) and
OPERATION

Table 3 needs to have the foreign key AREA_ID added to it and Table 4
needs to have the foreign key MODEL_NO_ID added to it

The query I have to add AREA_ID to Table 3 is as follows:

INSERT INTO Model_No ([Model No], Model_No_ID, Area_ID)
SELECT Model_No.[Model No], Model_No.Model_ No_ID (SELECT Area.Area_ID
FROM Area
WHERE Model_No.Model_ No = WI_TOC.Model_No AND Area.Area = WI_TOC.Area)

AS Area_ID
FROM Model_No, WI_TOC;

This isn't working though. Any help would be much appreciated!

Jun 13 '06 #1
3 2088
You'll need to write the key of the main table as a foreign key in your
make-table queries, not try to find the relationships afterward.

If you don't have to be periodically re-creating your data tables from a new
or updated spreadsheet, and it is difficult to determine a natural key, you
may want to import the whole spreadsheet into a table, add an AutoNumber
field as a surrogate key, and make sure you copy that in your make-table
queries.

Larry Linson
Microsoft Access MVP

<Ja************ @ge.com> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .
I have a table in my database that is linked to an excel spreadsheet. I
need to be able to manipulate the data in this linked table so that I
can create smaller normalized tables that work with what I am trying to
do (all data used in my db will come from this one spreadsheet). I am
currently trying to utilize the make-table queries to create the tables

that I need from this data, however I am unsure of how to add foreign
keys to a table so that my data matches up correctly. Does anyone know
of a way to do this? Is there some sort of append query that can be
ran to find entries in one table matching the entries of another table
as the criterion?

Current Tables:

1) Linked Table - WI_TOC with fields AREA, MODEL_NO, OPERATION and
FILE NAME

2) AREA with fields AREA_ID (autonumber primary key) and AREA

3) MODEL_NO with fields MODEL_NO_ID (autonumber primary key) and
MODEL_NO

4) OPERATION with fields OPERATION_ID (autonumber primary key) and
OPERATION

Table 3 needs to have the foreign key AREA_ID added to it and Table 4
needs to have the foreign key MODEL_NO_ID added to it

The query I have to add AREA_ID to Table 3 is as follows:

INSERT INTO Model_No ([Model No], Model_No_ID, Area_ID)
SELECT Model_No.[Model No], Model_No.Model_ No_ID (SELECT Area.Area_ID
FROM Area
WHERE Model_No.Model_ No = WI_TOC.Model_No AND Area.Area = WI_TOC.Area)

AS Area_ID
FROM Model_No, WI_TOC;

This isn't working though. Any help would be much appreciated!

Jun 13 '06 #2
tangential reply, but just wondering why you need to break up a fairly
simple table:

CREATE TABLE wi_toc (
RecordID Autonumber PRIMARY KEY,
Area Text(20) NOT NULL,
ModelNo Text(30),
Operation Text(50),
FileName Text(100));

All the other tables you suggest seem to be just lookup tables. Or is
there a one-to-many relationship you need to break up? (Like each
wi_toc record can have more than one {Area, ModelNo, Operation, or
FileName} associated with it?)

Otherwise, there's really no reason to break up the table at all.
Unless it's seriously huge (over 2 GB).

Just wondering, that's all.

Jun 14 '06 #3
You are right...no need to even split up the table! I tend to make
things way more complicated then they need to be. Thanks for pointing
that out.

Jun 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6786
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
20
2769
by: Steve Jorgensen | last post by:
Hi all, I've just finished almost all of what has turned out to be a real bear of a project. It has to import data from a monthly spreadsheet export from another program, and convert that into normalized data. The task is made more difficult by the fact that the structure itself can vary from month to month (in well defined ways). So, I used the SQL-centric approach, taking vertical stripes at a time so that, for instance, for each...
4
3025
by: Steve Jorgensen | last post by:
I'm restarting this thread with a different focus. The project I'm working on now id coming along and will be made to work, and it's too late to start over with a new strategy. Still, I'm not coming to a firm conclusion over whether it was the better approach, and wonder if I should do it differently the next time I'm faced with a similar issue. I needed an app to automatically import from spreadsheets with a semi-dynamic structure,...
8
4041
by: Alfonso Esteban Gonzalez Sencion | last post by:
I am trying to use Access as a front end for extracting information from an Oracle database. I started using linked tables but I am getting a very curious behaviour. When I consult the linked table in access, the total number of records is OK but some records appear several times and some records do not appear at all. It seems as if access or the ODBC drivers returns several times the same record and skips some of the records, curiosly...
7
11835
by: Joe | last post by:
I am using Access 2003 and are linking to an Oracle 9i ODBC datasource (using Oracle ODBC drivers). After linking the tables in Access, I inspect the data contained in the linked tables. For tables that involve a number field as the primary key, the data is returned successfully. For tables that involve a character field (e.g. CHAR(3) or VARCHAR(10)) as the primary key, I have the correct number of rows returned, but the data displayed...
15
7260
by: brettclare | last post by:
I have linked a large SQL Server table to Access, however 'only' 2,195,439 records are shown and are available to query. Can I increase the size (cache??)/number of records showing in Access? Thank you.
8
2555
by: Janelle.Dunlap | last post by:
My database is linked to external data from a single Excel spreadsheet. I currently have it so that the entire spreadsheet exports into one table, but really for the purpose of my database it will need to somehow be split into smaller tables either before or after export. The problem lies in the fact that I need to be able to do this all programatically through vb code and still keep the links to the spreadsheet. Any suggestions?
10
7706
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on close' I think that I have read in some threads (althoug I cannot find them now) that others place such tables in a local, linked database. I could do this but I am interested to know what would be the advantages. And disadvantages, if any. Any...
3
5129
by: Bret Kuhns | last post by:
I recently started a co-op/internship at a company and they are looking to migrate a large legacy supported application from OLEDB to SQL Server. I'm doing prelim work in experimenting with the options available. The application is huge (1+ million lines of C++ code), so it'd be quite a bit of man hours to adapt all the database code for SQL Server. I stumbled upon linked tables in an OLEDB file to an ODBC source (such as SQL Server) and...
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.