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?
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?