View Full Version : chkBox driving me mad


A real begineer
06-03-2001, 12:13 AM
Okay, I thought this was really simple, but there must be something Iam not seeing.

QryResults lists the results for an individual client. For every third result I want chkClarifier to be true, that is enable dose.

This code should set chkClarifier to true on every third record but it is not firing correctly.

I have this code set on the command button to open the report.


Dim sngA As Single
Dim sngB As Single

sngA = DLookup("[ID]", "[qryResults]", "[Clarifier]=True")
sngB = DLookup("[ID]", "[qryResults]")
If sngB - sngA >= 3 Then
chkClarifier = True
End If

Pat Hartman
06-03-2001, 10:37 AM
DLookUp() is a function. Functions return a single value. If the selection criteria you supply to the function does not result in a single value being returned, DLookup() just returns a random value from the set.

I doubt that your first DLookup() is returning the ID you are looking for and I know the second is not.

Since you are doing this in a report, you can put counting code in the Format event to count to three, set the variable and reset the counter.