Check box returns false even when checked

garethl

Registered User.
Local time
, 20:07
Joined
Jun 18, 2007
Messages
142
I've got a table with two yes / no fields (Pass / Fail) behind a datasheet form
For each record in the table user needs to flag a check box for EITHER pass OR fail but not both (I know I could just have one check box but my boss wants them to have to make a choice for every record rather than have either pass or fail as a default)

I have this code in form unload to check whether at least one of the boxes is ticked for every record.. haven't got as far as adding a condition to check they don't flag BOTH because this doesn't work as expected..

Private Sub Form_Unload(Cancel As Integer)
Set rst = Me.Form.RecordsetClone
Dim ok As Boolean
ok = True
rst.MoveFirst
Do Until rst.EOF
If rst!Pass = False And Recordset!Fail = False Then
ok = False
End If
rst.MoveNext
Loop
End Sub

with 2 records in the table it works as expected for every combination of the two records being flagged or unflagged EXCEPT first record pass flagged Fail unflagged, second record pass unflagged and fail flagged.

In that situation it thinks Fail is unflagged and 'ok' is returned as false

Any ideas WHY?
 
You may be better using option groups and have 2 options Y and N and set the values to -1 and 0 respectively.
 

Users who are viewing this thread

Back
Top Bottom