importing fields from 1 DB to another DB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to import 4 fields from database1 into a table in database2.
Here is the code I am using:

vSQL = "INSERT INTO CITY_TABLE SELECT [Field1],[Field2],[Field3],[Field4]
FROM [All_Officesl] IN 'C:\Locations\City.mdb' WHERE [Field1] = '" & Loc & "'"

Set Recordset = New ADODB.Recordset
Call Recordset.Open(vSQL, ConnectionString, adOpenForwardOnly,
adLockReadOnly, CommandTypeEnum.adCmdText)

Set Recordset = Nothing

City_Table is the table in database2

Loc is a variable that identifies which retail location this is getting

ConnectionString is a variable that is the same as the IN statement
('C:\Locations\City.mdb' )

I keep getting an error message that says the Output table cannot be located.

What am I doing wrong....Thanks for the help.
 
Why are you using Open Recordset for an INSERT SQL???

Shouldn't it be Connection.Execute?

Check Access / VB Help / AD on Execute method.
 
Back
Top