p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   How can I merge two databases and tickets tables? (http://p2p.wrox.com/showthread.php?t=19359)

drarem October 4th, 2004 10:10 AM

How can I merge two databases and tickets tables?
The basic code I have as below, to merge Tickets1 table into Tickets table, provided you brought in Tickets1 via Get External Data..

How would I merge database on c:\dir1\event.mde (table tickets) into f:\dir3\subdir\event.mde (table tickets)?

Private Sub Command1_Click()
''INSERT INTO maintable SELECT * from temptable WHERE someidfield NOT IN (select someidfield FROM maintable)
Dim strLogs As String

strLogs = "INSERT INTO [Tickets] SELECT * FROM [Tickets1] WHERE [TicketID] NOT IN (SELECT [TicketID] FROM [Tickets]);"
DoCmd.RunSQL strLogs
End Sub


drarem October 4th, 2004 12:58 PM

I found out I could do the TransferDataBase and export, but it replaces the table instead of merging them..

help please.


lguzman October 5th, 2004 01:07 PM

You should link one of your tables in the other database file. Create a append query. This should allow you to append the records from table A into table B.


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

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