DoCmd.TransferDatabase – need assistance with syntax. keep receiving runtime 13 type mismatch error

Question : DoCmd.TransferDatabase – need assistance with syntax.  keep receiving runtime 13 type mismatch error

Hello,

I have been trying to get this working now for a while but not having any success…. If someone can take a quick look and provide some insight I would really appreciate it.

What I am trying to do is automate the importing of a table from an Oracle database to my local access database.
When running the following code, I receive runtime error 3151 ODBC Connection to ‘GetPaid_7i.dsn’ failed.

DoCmd.TransferDatabase acImport, “odbc”, “ODBC;dsn=GetPAID_7i.dsn;UID=XXXX;PWD=XXXX;LANGUAGE=us_english;”, acTable, “GPCOMP1_GPCUST”, “TEST”

I have verified that the user name and password is correct.   Please let me know if you can assist.   Thanks!

expression.Transferdatabase(transfertype, databasetype, databasename, objecttype,source, destination, structureonly, storelogin.


 

Solution: DoCmd.TransferDatabase – need assistance with syntax.  keep receiving runtime 13 type mismatch error

Which Oracle driver are you using?

are you using Microsoft Oracle Driver or Oracle’s driver itself
It the latter, then u can test your DSN via the ODBC control panel applet
if u can get yur connection going here then you know your TNS Names entry is fine

Another thing, try using “ODBC Database” instead of “odbc” as the third parameter
try changing database= to server=, does it help any?
also try specifying the schema owner in front of the tablename – u may find u have a synonym for that table and u cant import them

Dim sConn as String

sConn = “ODBC;DSN=GetPAID_7i;UID=XXX;PWD=XXX;SERVER=GPCOMP1”

‘or if SERVER= dont make a difference, go back to using DATABASE=
sConn = “ODBC;DSN=GetPAID_7i;UID=XXX;PWD=XXX;DATABASE=GPCOMP1”

DoCmd.TransferDatabase acImport, “ODBC Database”, sConn, acTable, “schema_name.GPCUST”, “TEST”