Re: MS Access selecting from Oracle database
Date: Wed, 12 Mar 2008 17:01:16 -0500
Just an FYI for those interested. You can connect from Access without ODBC if you already have Oracle client installed and tnsnames configured. The code below is from a spreadsheet I am working on (I removed the excel stuff) but it would work in Access also if you want to code a connection to Oracle. You need to reference the ADO library from the references menu.
Public Sub TestMe()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i As Long
Dim sSQLQuery As String
cn.Open "PROVIDER=OraOLEDB.Oracle;DATA SOURCE=PROD;USER ID=foo;PASSWORD=foo;"
sSQLQuery = "select x, y, z from test_table;"
rs.Open sSQLQuery, cn
i = 1
Do Until rs.EOF
i = i + 1
End SubReceived on Wed Mar 12 2008 - 17:01:16 CDT