Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

problem making a passthrough query via oracle in Access

I am having a problem with making an Access passthrough query in the following code which uses Oracle as the database:

Sub doit()
    Dim db As DAO.Database
    Dim qdf As DAO.QueryDef
    Dim rs As DAO.Recordset

    Set db = CurrentDb
    Set qdf = db.CreateQueryDef("")
    c = "Driver={Oracle in OraClient12102_64};dbq=<<location>>;PUID=<<myuid>>;PWD=<<mypwd>>;"
    qdf.Connect = c


    qdf.SQL = "SELECT * FROM SYS.DUAL"

    qdf.ReturnsRecords = True

    Set rs = qdf.openRecordSet
End Sub

The error message I get is Invalid connection string in pass-through query.
I use this connection string successfully when using ADODB.connection; however, it fails in this instance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

In DAO, when using an ODBC connection, you should prefix it with ODBC;

Adjust your code accordingly:

 c = "ODBC;Driver={Oracle in OraClient12102_64};dbq=<<location>>;PUID=<<myuid>>;PWD=<<mypwd>>;"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading