I have a table of some 11975 records. A boolean field called "label" defaults to "No", in a table called "All"
When I run the attached code it returns11975 positive results.
I use this field to trigger printing of a report and the report only prints the records with the "label" field checked.
I then clear all checked fields and run a slightly different version of the code to indicate all 'label" fields are negative but the code always responds with a positive field exists.
I have tried a copy, new record, paste, delete original and rename the copy but still get the same result.
Looking at the table on a form, the "label" field shows "No" unless it is ticked.
What am I doing wrong?
Public Function isLabel()
Dim rs As Recordset
Dim rsInt As Integer
rsInt = 0
Set rs = CurrentDb.OpenRecordset("All", dbOpenSnapshot, dbReadOnly)
rs.FindFirst rs!Label = True
Do While Not rs.EOF
rsInt = rsInt + 1
rs.MoveNext
rs.FindNext rs!Label = True
Loop
End Function
If I run this same code with "true" replaced with "false" rsInt returns 5989. What gives???
When I run the attached code it returns11975 positive results.
I use this field to trigger printing of a report and the report only prints the records with the "label" field checked.
I then clear all checked fields and run a slightly different version of the code to indicate all 'label" fields are negative but the code always responds with a positive field exists.
I have tried a copy, new record, paste, delete original and rename the copy but still get the same result.
Looking at the table on a form, the "label" field shows "No" unless it is ticked.
What am I doing wrong?
Public Function isLabel()
Dim rs As Recordset
Dim rsInt As Integer
rsInt = 0
Set rs = CurrentDb.OpenRecordset("All", dbOpenSnapshot, dbReadOnly)
rs.FindFirst rs!Label = True
Do While Not rs.EOF
rsInt = rsInt + 1
rs.MoveNext
rs.FindNext rs!Label = True
Loop
End Function
If I run this same code with "true" replaced with "false" rsInt returns 5989. What gives???
Last edited: