I just want to return the column data in table at corresponding textbox. I get the error message saying that there is no table pointed to, so i did change to
MyRecSet.Open ,"Table1",strSQL, MyConnect, , , adCmdTable
in below code.
But it gave this compile error instead.
Wrong number of arguments or invalid property assignment.
Below is a snippet of my code for refer.
Private Sub txtCTN_KeyDown(KeyCode As Integer, Shift As Integer)
Dim MyConnect As New ADODB.Connection
Dim MyRecSet As New ADODB.Recordset
Dim strSQL As String
Dim conn As String
If KeyCode = 13 Then
Set MyConnect = New ADODB.Connection
MyConnect.ConnectionString = "Driver={Microsoft ODBC for Oracle};" & _
"UID = username; PWD = password"
MyConnect.Open
If Trim(txtCTN.Text = "") Then
MsgBox "Please Scan the CTN!", vbOKOnly, "Field Required!"
txtCTN.SetFocus
Else
strSQL = "select DATE from TABLE1 where CTN = " & txtCTN.Text
MyRecSet.CursorType = adOpenStatic
MyRecSet.CursorLocation = adUseClient
MyRecSet.LockType = adLockOptimistic
'The error points to below this line
MyRecSet.Open strSQL, MyConnect, , , adCmdTable
'Check if whether the CPN is in the table or not
If MyRecSet.EOF = False And MyRecSet.BOF = False Then
txtDate.Text = Trim(MyRecSet.Fields("" & Trim(GetINISetting("Db_Data", "F_Date", App.Path & "\SETTINGS.INI")) & ""))
'other code below here
'....
End Sub
Any help would be much appreciated. Thanks.

New Topic/Question
Reply




MultiQuote



|