I'm trying to connect to an Oracle Database with Access 2003.
I want to use an ODBC connection and I want to set it up so that the user doesn't need to enter a password.
One of the problems I am having though is my sql query uses INTERFACE.Products and Access sees the period and thinks I'm trying to opening a file. IE Interface.MDB, when thats a part of my sql query.
Option Compare Database
Function OracleConnect() As Boolean
Dim ws As Workspace
Dim db As Database
Dim LConnect As String
Dim myQuery As String
Dim myRS As Recordset
On Error GoTo Err_Execute
LConnect = "ODBC;DSN=Oracle;UID=user;PWD=password;"
'Point to the current workspace
Set ws = DBEngine.Workspaces(0)
'Connect to Oracle
Set db = ws.OpenDatabase("", False, True, LConnect)
myQuery = "Select * from INTERFACE.Products"
Set rst = db.OpenRecordset(myQuery)
rst.Close
db.Close
Exit Function
Err_Execute:
MsgBox MsgBox("Error Number: " & Err.Number & " Message: " & Err.Description)
End Function