ODBC import syntax

  • Thread starter Thread starter Vina
  • Start date Start date
V

Vina

I am using access 97 and trying to create a command
button that will import the table from a ODBC connection.
I tried using the macro but not sure of what I need to
put in the field.

Tried the DoCmd.TransferDatabase but also not sure of the
syntax.

Can someone give me some idea on how to do this using a
command button??

Thanks
 
Hi Vina,

On the event "on click" you can write the following text :
DoCmd.TransferDatabase acImport, "ODBC", _
"ODBC;DSN=«Name of your server»;UID=«Name of the
user»;PWD=«Password of the user»;DATABASE=«External
database»", _
acTable, "«Name of the table in the external
database»", "«Name of that table you want to give in
Access»"

You should be able to use the same script in the macro:
Transfer type : Import
Database type : ODBC
Database name : «The same line use in the TransferDatabase
command» i.e. ODBC;DSN=«Name of your server»;UID=«Name of
the user»;PWD=«Password of the user»;DATABASE=«External
database»
Object type : Table
Source : «Name of the table in the external database»
Destination : "«Name of that table you want to give in
Access»
Structure only : No

Good luck.
 
Back
Top