Hi I'm trying to get information from one subform to another. Everything works fine if I SELECT * FROM tbl but if I add a WHERE clause or try to SELECT a column name I can't see any record information. Here is my code. Can anyone please tell me what I'm doing wrong?
Thanks!
Dim rst As ADODB.Recordset
Dim CurDB As Database
Dim curID As Integer
Dim curDiagNo As String
Dim myCode As String
curID = [Forms]![SuperBill]![sbID]
curDiagNo = Me![diag8]
Set CurDB = CurrentDb
Set CurConn = New ADODB.Connection
'CurrentProject.Connection
curID = [Forms]![SuperBill]![sbID]
With CurConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "data source= " & CurDB.Name
.Open
End With
'Open read-only recordset to get codeEntry value
Set rst = New ADODB.Recordset
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
'This works without where clause
rst.Open "SELECT * FROM tblDiagEntry WHERE sbID = curID and diagNo = curDiagNo", CurConn
Thanks!
Dim rst As ADODB.Recordset
Dim CurDB As Database
Dim curID As Integer
Dim curDiagNo As String
Dim myCode As String
curID = [Forms]![SuperBill]![sbID]
curDiagNo = Me![diag8]
Set CurDB = CurrentDb
Set CurConn = New ADODB.Connection
'CurrentProject.Connection
curID = [Forms]![SuperBill]![sbID]
With CurConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "data source= " & CurDB.Name
.Open
End With
'Open read-only recordset to get codeEntry value
Set rst = New ADODB.Recordset
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
'This works without where clause
rst.Open "SELECT * FROM tblDiagEntry WHERE sbID = curID and diagNo = curDiagNo", CurConn