J
jutlaux
I am using the below code to 1) automatically connect to a Microsoft ODBC for
Oracle connection called "FIN_CUR" and 2) run an query on a linked table in
FIN_CUR
The issue i am having is that the ODBC connect part of the script appears to
be working, but when it goes to try to run the query I still get the popup
prompting for user name and password to make the connection to the ODBC. I
have verify that the user name and password are correct, but don't know what
I am missing.
Here is my code
Public Sub OraConnect()
Dim strErr As String
On Error GoTo connError
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=MSDAORA.1; User
ID=GENERIC;Password=GENERIC; Data Source=FIN_CUR;"
conn.Open
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = conn
DoCmd.OpenQuery "qappFIN_CUR_Truncate", , acReadOnly
Exit Sub
'
' handle Oracle error
'
connError:
strErr = "Error connecting to Oracle"
strErr = strErr & Chr(13) & Chr(10) & Chr(13) & Chr(10)
strErr = "Reports will NOT be created"
strErr = strErr & Chr(13) & Chr(10) & Chr(13) & Chr(10)
strErr = strErr & Err.Description
MsgBox (strErr)
Exit Sub
End Sub
Oracle connection called "FIN_CUR" and 2) run an query on a linked table in
FIN_CUR
The issue i am having is that the ODBC connect part of the script appears to
be working, but when it goes to try to run the query I still get the popup
prompting for user name and password to make the connection to the ODBC. I
have verify that the user name and password are correct, but don't know what
I am missing.
Here is my code
Public Sub OraConnect()
Dim strErr As String
On Error GoTo connError
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=MSDAORA.1; User
ID=GENERIC;Password=GENERIC; Data Source=FIN_CUR;"
conn.Open
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = conn
DoCmd.OpenQuery "qappFIN_CUR_Truncate", , acReadOnly
Exit Sub
'
' handle Oracle error
'
connError:
strErr = "Error connecting to Oracle"
strErr = strErr & Chr(13) & Chr(10) & Chr(13) & Chr(10)
strErr = "Reports will NOT be created"
strErr = strErr & Chr(13) & Chr(10) & Chr(13) & Chr(10)
strErr = strErr & Err.Description
MsgBox (strErr)
Exit Sub
End Sub