Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2007

Tip: Looking for answers? Try searching our database.

importing fields from 1 DB to another DB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JT - 09 Mar 2007 21:23 GMT
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.
Signature

JT

Van T. Dinh - 10 Mar 2007 04:32 GMT
Why are you using Open Recordset for an INSERT SQL???

Shouldn't it be Connection.Execute?

Check Access / VB Help / AD on Execute method.

Signature

HTH
Van T. Dinh
MVP (Access)

>I am trying to import 4 fields from database1 into a table in database2.
> Here is the code I am using:
[quoted text clipped - 20 lines]
>
> What am I doing wrong....Thanks for the help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.