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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|