A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

merging databases



 
 
Thread Tools Display Modes
  #1  
Old April 25th, 2004, 03:05 AM
Miles
external usenet poster
 
Posts: n/a
Default merging databases

I have an Access 2003 database containing about 150
tables. Almost all of the tables use an autonumber field
as a primary key. How do I merge records from two copies
of the same database from two different users? The
problem is that the autonumber fields will overlap. One
solution I thought of is to use a two field primary key
for each table where one field was an autonumber field
and the second field is a unique user id. Is this the
only way to do it? Are there better ways?

Thks Miles.
  #2  
Old April 25th, 2004, 02:44 PM
Marin Kostov
external usenet poster
 
Posts: n/a
Default merging databases

Use Append Query.
Here is how to do it:
Let's say, you have two tables, tblMain, which is the first table, and
tblSecond, which contains the records you need to append to the first table.
So, open the Queries object, and create new Query in Design View. In the
Show Table dialog, select tblSecond and click Add. Close the window.
Then change the Query to Append. In the Append to select tblMain.
Drag all fields from tblSecond to the lower pane, except the Primary Key.
Then click the ! sign to run the Query.
Answer Yes to the question.
You are ready. You have append the fields, and the Autonumber is generated
by Access. You don't need to worry about it.

--
Marin Kostov
Microsoft Office XP Master Instructor


  #3  
Old April 25th, 2004, 03:35 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default merging databases

With 150 tables, I expect there are tables with records related to
autonumbers from other tables. A simple append query will not update the
related records.

You could try run code that would set all of the autonumber fields in the
"copies" to standard, long integer fields. If you have referential integrity
set on with cascade updates, you should be able to update the previous
autonumber fields to numbers greater than the autonumber fields in the
original mdb. This should allow you to append the records from the copies to
ther original. NOTE: I would test this prior to doing this with live mdbs.

--
Duane Hookom
MS Access MVP


"Marin Kostov" wrote in message
...
Use Append Query.
Here is how to do it:
Let's say, you have two tables, tblMain, which is the first table, and
tblSecond, which contains the records you need to append to the first

table.
So, open the Queries object, and create new Query in Design View. In the
Show Table dialog, select tblSecond and click Add. Close the window.
Then change the Query to Append. In the Append to select tblMain.
Drag all fields from tblSecond to the lower pane, except the Primary Key.
Then click the ! sign to run the Query.
Answer Yes to the question.
You are ready. You have append the fields, and the Autonumber is generated
by Access. You don't need to worry about it.

--
Marin Kostov
Microsoft Office XP Master Instructor




 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.