Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 13th, 2005, 02:30 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to CORiverRat Send a message via MSN to CORiverRat Send a message via Yahoo to CORiverRat
Default Need to merge several tables with unlike structure

Here is my problem. I have several different excel spreadsheets from several different sources (each has inventory data, taken by several different people at different times and one is generated electronically by our network team). I have brought them all into access and created tables from them. Each one has its own set of fields although they all have one field in common (host name). My problem is that I need to merge all of these into one database, and in doing so keep all the records from each database that are not in the other databases. I am willing to do this in a multistep process (create a query, merge two to a table, create a new query using this table and the next table on the list and so on).

I am new to Access and am looking for any help anyone can give me on how to best attack this problem.

Thanks in advance for any help you might be able to provide or point me to.

Roger

Reply With Quote
  #2 (permalink)  
Old December 13th, 2005, 03:48 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

This is pretty easy if you have a lot of fields that have the same sort of information in them, but different field names.

What I have done it to create a query on the first table with all of the fields in it, but rename the ones you need to according to a pre-determined naming convention, like this: NewName:([OldName])

Then turn the query into a Make Table Query, then make a new table that is going to store all this accumulated data.

Then from the other tables, do the same thing, but make them Append queries, and then append those tables, of course sticking to your naming convention.

Then once you have all the tables consolidated into one table, do a Duplicates query to find your duplicate entries (if you want to get rid of them.)

This should take about as long as it takes you to read this.

HTH

mmcdonal
Reply With Quote
  #3 (permalink)  
Old December 13th, 2005, 05:21 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to CORiverRat Send a message via MSN to CORiverRat Send a message via Yahoo to CORiverRat
Default

Thought of doing that, but don't want to have duplicate records from each database, rather want the data to accumulate into the records... Like in the first merge with the network database (most inclusive) pick up machine type, sw load and room number from one manual inventory. Then take results of that and pick up other new fields like jack number from another database (as well as a room number if they show it and so on.

Tried using a union query of the first two but it gives me duplicate records.

Thanks

Roger

Reply With Quote
  #4 (permalink)  
Old December 13th, 2005, 05:33 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Eliminating duplicate records takes almost no time at all, and can be done in one sweep at the end.

Reply With Quote
  #5 (permalink)  
Old December 14th, 2005, 11:41 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to CORiverRat Send a message via MSN to CORiverRat Send a message via Yahoo to CORiverRat
Default

Problem was, the dup record each had their own information in them, they didn't merge into a single record with dups, that I could handle. Instead I would have one record with certain fields, another record with other fields etc. One thing I did try is multiple queries with changing my joins each time so I could pull in one group of records, then another group of records. This worked best so far but I just figured their had to be an easier way to pull in the records and create one record that held all the info I had from multiple tables.

Roger

Reply With Quote
  #6 (permalink)  
Old December 14th, 2005, 12:58 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Oh, that is easy. Just pull in all the fields from both tables, but only use the one or several common fields once from each table, and then join the tables on the common field.

For example:

tblOne
OneID - PK
FName
LName
Username (linked field)
Address
City
State
Zip

tblTwo
TwoID
FName
LName
Username
Email
Hobby

qryLinkTables
(join tblOne and tblTwo on UserName)
tblOne.FName
tblOne.LName
tblOne.UserName
tblOne.Address
tblOne.City
tblOne.State
tblOne.Zip
tblTwo.Email
tblTwo.Hobby

Does this help?

mmcdonal
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataSet - Merge Data Tables srish ADO.NET 0 September 8th, 2007 10:04 AM
Whether or not to merge two tables chrislepingwell SQL Language 1 November 24th, 2005 06:18 PM
How to Merge Tables into one query sorcerer Access 5 March 11th, 2005 04:19 AM
Word E-Mail Merge using Access Tables Richard Lally Access 2 February 7th, 2005 04:48 AM
How can I merge two databases and tickets tables? drarem Access VBA 2 October 5th, 2004 01:07 PM



All times are GMT -4. The time now is 03:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.