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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append not Create

Status
Not open for further replies.

LiLgUrL

Technical User
Feb 9, 2003
59
0
0
CA
i want to import xls into my table (i mean append not create a new table) the code below creates new table
... the solution that i have as not to receive the error
MyTable already exists... table will be deleted first...
Question: Is there any other way to solve this?

Dim conX As ADODB.Connection
Set conX = New ADODB.Connection
conX.Open "DSN=Excel Files;DBQ=C:\My Documents\Book1.xls;" _
& "DefaultDir=C:\My Documents;DriverId=22;" _
& "MaxBufferSize=2048;PageTimeout=5;"
conX.Execute "SELECT Field1, Field2, Field3 INTO MyTable " _
& "IN 'C:\My Documents\db1.mdb' FROM [Sheet1$]"
conX.Close
Set conX = Nothing


Please advice,
~Tai
 
ei what happened no more reply i have 5 yesterday? how come zero?
 
You will want to look into the INSERT INTO TableName (Field1, Field2, Field3) SELECT Field1, Field2, Field3 FROM TableName WHERE ...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top