Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Appending tables from two files

Status
Not open for further replies.

BusMgr

IS-IT--Management
Aug 21, 2001
138
US
I have two files ('field' and 'master') that I want to append the data from 'field' into 'master'. Everything is the same between the files (tables, table structure, etc) except as you can surmise, the field file is on a laptop and the master is the office master. I know that replication could do this, but my boss does not want to use replication.

I have created a form with two text boxes, Common Dialog Control and three cmd buttons (to select the field file, the master file, and an Update Now button)

Due to the primary and foreign key restraints, I have to append the tables in a specific order (A, B, C, etc)

dim strSQL as string
docmd.setwarnings false
strSQL = " INSERT INTO me!txtmaster.A SELECT * from me!txtfield.A"
docmd.runSQL strSQL
..
..
..
docmd.setwarnings true

I keep getting a syntax error msgbox re the INSERT INTO statement.

Thanks for your help.

BusMgr
 
What about:

dim strSQL as string
docmd.setwarnings false
strSQL = " INSERT INTO " & me!txtmaster.A & " SELECT * from " & me!txtfield.A
docmd.runSQL strSQL
..
J. Jones
jjones@cybrtyme.com
 
No, I get an error message that object doesn't support this methd or property.

BusMgr
 
Okay, I think I'm missing something...What is the .A you are referring to? Do you mean:


strSQL = "INSERT INTO " & me!txtmaster & " SELECT * from " & me!txtfield & ";"


In your code, have you set a breakpoint and looked to see what strSQL looks like? I usually do that or display a message box and look at my SQL statement to determine where my error is. J. Jones
jjones@cybrtyme.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top