Import all records from external table

L

Luis M

Hi everybody!

Please give some suggestions:

I'm trying to use the following code to bring all data in an external table
to a table in my BD, but it fails and the message is something like: "Error
connecting with MyDSN"

CurrentProject.Connection.Execute "INSERT INTO Clientes (NIT, NOMBRE) SELECT
NIT, NOMBRE FROM " & "[ODBC;DSN=MyDSN;UID=;PWD=;].Clientes


Thanks

Luis
 
D

Douglas J. Steele

Try:

CurrentProject.Connection.Execute "INSERT INTO Clientes (NIT, NOMBRE) SELECT
NIT, NOMBRE FROM Clientes IN [ODBC;DSN=MyDSN;UID=;PWD=;]"
 
D

Douglas J. Steele

Hold on. I take it back. I'm not sure you can do that using ADO: ADO doesn't
allow multiple connections in a single statement.

You might have to create a linked table to the MySQL table, and work with
it.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Douglas J. Steele said:
Try:

CurrentProject.Connection.Execute "INSERT INTO Clientes (NIT, NOMBRE)
SELECT
NIT, NOMBRE FROM Clientes IN [ODBC;DSN=MyDSN;UID=;PWD=;]"



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Luis M said:
Hi everybody!

Please give some suggestions:

I'm trying to use the following code to bring all data in an external
table to a table in my BD, but it fails and the message is something
like: "Error connecting with MyDSN"

CurrentProject.Connection.Execute "INSERT INTO Clientes (NIT, NOMBRE)
SELECT
NIT, NOMBRE FROM " & "[ODBC;DSN=MyDSN;UID=;PWD=;].Clientes


Thanks

Luis
 
O

onedaywhen

Douglas said:
Hold on. I take it back. I'm not sure you can do that using ADO: ADO doesn't
allow multiple connections in a single statement.

I think you were correct first time.

You can indeed have multiple ODBC connections in a Jet sql
query/statement. Executing the SQL via ADO makes no difference. For
example, this works for me with an ADO connection to Jet:

SELECT * INTO
[ODBC;Driver={SQL
Server};SERVER=SERVER2;DATABASE=Airplanes;UID=;Pwd=;].Pilots
FROM [ODBC;Driver={SQL
Server};SERVER=SERVER1;DATABASE=Airplanes;UID=;Pwd=;].Pilots;

Jamie.

--
 
L

Luis M

Douglas, I made changes in the code but sitll doesn't work. Now the message
is "Don't find My Documents ODBC;DSN=MyDSN file"

Thanks

Luis

Douglas J. Steele said:
Hold on. I take it back. I'm not sure you can do that using ADO: ADO
doesn't allow multiple connections in a single statement.

You might have to create a linked table to the MySQL table, and work with
it.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Douglas J. Steele said:
Try:

CurrentProject.Connection.Execute "INSERT INTO Clientes (NIT, NOMBRE)
SELECT
NIT, NOMBRE FROM Clientes IN [ODBC;DSN=MyDSN;UID=;PWD=;]"



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Luis M said:
Hi everybody!

Please give some suggestions:

I'm trying to use the following code to bring all data in an external
table to a table in my BD, but it fails and the message is something
like: "Error connecting with MyDSN"

CurrentProject.Connection.Execute "INSERT INTO Clientes (NIT, NOMBRE)
SELECT
NIT, NOMBRE FROM " & "[ODBC;DSN=MyDSN;UID=;PWD=;].Clientes


Thanks

Luis
 

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