M
Mark Schirle
I am having a problem with a query.
A form with a button to run the following procedure
A table with 3 fields. Autonumber, Test (True/False) and TestCode
(Text)
4 records in the table
All records contain testcode = 5
3 records contain test = False
1 record contains test = true
When I run the procedure the msgbox says recordcount = 4
When I copy the strsql from the debug.print into a query the recordcount
= 1
What am I doing wrong?
Private Sub Command0_Click()
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM tblTest WHERE test = True and testcode =
'5'"
Debug.Print strSQL
Set rs = CurrentDb.OpenRecordset(strSQL)
With rs
MsgBox .RecordCount
End With
End Sub
A form with a button to run the following procedure
A table with 3 fields. Autonumber, Test (True/False) and TestCode
(Text)
4 records in the table
All records contain testcode = 5
3 records contain test = False
1 record contains test = true
When I run the procedure the msgbox says recordcount = 4
When I copy the strsql from the debug.print into a query the recordcount
= 1
What am I doing wrong?
Private Sub Command0_Click()
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM tblTest WHERE test = True and testcode =
'5'"
Debug.Print strSQL
Set rs = CurrentDb.OpenRecordset(strSQL)
With rs
MsgBox .RecordCount
End With
End Sub