Hi Experts,
I set up an ODBC and created a linktable in access2007 from oracle database.
I created form based on linktable and try to code a column click event.
The code as
Private Sub CONFIRMATION_NUMBER_Click()
Dim curDatabase As Object
Dim rstNWD As Object
Dim INVNUM As Integer
Dim conConnector As ADODB.Connection
Dim strConnection As String
Dim strStatement As String
strStatement = "select max(invoce_NUMBER) from sale_info;"
Set curDatabase = CurrentDb
Set tblNWD = curDatabase.TableDefs("SALES")
'Set rstNWD = curDatabase.OpenRecordset("SALES")
Set curDatabase = Application.CurrentProject
' or this option
Set conConnector = New ADODB.Connection
conConnector.Open "DSN=sales_ODBC;UID=SALE2;PWD=sale_rep;"
conConnector.Open strConnection
conConnector.Execute strStatement
MsgBox strStatement.INVNUM
Set rstNWD = Nothing
Set curDatabase = Nothing
End Sub
I got a compile error as user-defined type not defined. debug stop at Dim conConnector As ADODB.Connection
Actually, I already set up a oracle ODBC connection and works. Access is able to select all data from oracle database.
Please help me how to program to access database by ODBC
Thanks
newaccess