 |
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 13th, 2005, 02:30 PM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 13th, 2005, 03:48 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
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
|
|

December 13th, 2005, 05:21 PM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 13th, 2005, 05:33 PM
|
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Eliminating duplicate records takes almost no time at all, and can be done in one sweep at the end.
|
|

December 14th, 2005, 11:41 AM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 14th, 2005, 12:58 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
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
|
|
 |