Need Help Using Select INTO from on mdb to another.

F

fracassa

I am trying to use a SELECT INTO statment (using VB 2005) to Insert
records from a "table1" in one mdb to a "table2" in second mdb located
in another location.

The problem is that the columns in the table2 have different names then
the ones in table1. (I have variables that describe the difference)

In the following Example, I want to take ONLY the IndexDate and IndexID
from Table 1 and insert them in to ControlGroupDate and ControlGroupID
(respectively) in table2

Table1 in c:\projects.mdb
IndexDate
IndexID
BatchNumber

Table2 in c:\finished.mdb
ControlGroupDate
ControlGroupID
Model
ScanDate

Can someone please help me with the syntax to do this?
 
P

Paul Clement

On 17 May 2006 09:01:50 -0700, (e-mail address removed) wrote:

¤ I am trying to use a SELECT INTO statment (using VB 2005) to Insert
¤ records from a "table1" in one mdb to a "table2" in second mdb located
¤ in another location.
¤
¤ The problem is that the columns in the table2 have different names then
¤ the ones in table1. (I have variables that describe the difference)
¤
¤ In the following Example, I want to take ONLY the IndexDate and IndexID
¤ from Table 1 and insert them in to ControlGroupDate and ControlGroupID
¤ (respectively) in table2
¤
¤ Table1 in c:\projects.mdb
¤ IndexDate
¤ IndexID
¤ BatchNumber
¤
¤ Table2 in c:\finished.mdb
¤ ControlGroupDate
¤ ControlGroupID
¤ Model
¤ ScanDate
¤
¤ Can someone please help me with the syntax to do this?

Make your connection to the database containing Table2 and try something like the following:

INSERT INTO [Table2] (ControlGroupDate, ControlGroupID) SELECT IndexDate, IndexID FROM [MS
Access;DATABASE=<database path for table1 goes here>;].[Table1]


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top