Every day I import a table from our AS/400 using:
File | Get External Data | Import | ODBC Databases | Machine Data Source [NYC400]
Here I insert the Password and select my Table and
I am done. This works beautiful.
I'm trying to automate this with VBA code without any luck so far this is where I am stuck:
DoCmd.TransferDatabase acImport, _
"ODBC Database", "ODBC;DSN=NYC400;UID=XXXX;PWD=YYYY;" _
& "DATABASE=NYCPROD", acTable, "CONTACTS"
Here are the facts:
DSN NAME: NYC400
USER ID: XXXX
P/W: YYYY
DATABASE: NYCPROD
TABLE NAME [imported into Access] CONTACTS
Full code:
Public Sub DWBase()
Dim db As DAO.DATABASE
Set db = CurrentDb
DoCmd.TransferDatabase acImport, _
"ODBC Database", "ODBC;DSN=NYC400;UID=ACBS;PWD=ACBS;" _
& "DATABASE=NYCPROD", acTable, "CONTACTS"
End Sub
Help
File | Get External Data | Import | ODBC Databases | Machine Data Source [NYC400]
Here I insert the Password and select my Table and
I am done. This works beautiful.
I'm trying to automate this with VBA code without any luck so far this is where I am stuck:
DoCmd.TransferDatabase acImport, _
"ODBC Database", "ODBC;DSN=NYC400;UID=XXXX;PWD=YYYY;" _
& "DATABASE=NYCPROD", acTable, "CONTACTS"
Here are the facts:
DSN NAME: NYC400
USER ID: XXXX
P/W: YYYY
DATABASE: NYCPROD
TABLE NAME [imported into Access] CONTACTS
Full code:
Public Sub DWBase()
Dim db As DAO.DATABASE
Set db = CurrentDb
DoCmd.TransferDatabase acImport, _
"ODBC Database", "ODBC;DSN=NYC400;UID=ACBS;PWD=ACBS;" _
& "DATABASE=NYCPROD", acTable, "CONTACTS"
End Sub
Help