Checkbox

tegb

Registered User.
Local time
Yesterday, 23:09
Joined
Feb 14, 2012
Messages
49
I have a table with some Yes (-1)/NO (0) fields, i want if a checkbox on a form is checked to assign a Yes (-1) value to the table, if not checked assign No (0)
the below code assigns a Yes value regardless of whether the checkbox is checked or not, what am i missing? please help

If Me.ChkMeasure = Null Then
tblpool![Measure] = False
ElseIf Me.ChkMeasure = False Then
tblpool![Measure] = False
Else
tblpool![Measure] = True
End If

If Me.ChkImprove = Null Then
tblpool![Improve] = False
ElseIf Me.ChkImprove = False Then
tblpool![Improve] = False
Else
tblpool![Improve] = True
End If
 
Is the checkbox bound to a field?

Edit: There appears to be a number of potential issues with your logic, like trying to write directly to a table.. Can you describe in more detail how your form, etc is set up?
 
Nothing is "=" to Null. Try

If IsNull(Me.ChkMeasure) Then
 
@tegb: If you are interested in only True / False (Checked / Unchecked) then I would suggest you just avoid the third "grey" state which should simplify your code.

Consider if for new records if it is more likely that users would need it in checked / unchekced state and preset the check box that way when the form opens. Doing so will avoid the third / grey state.

For existing records coming into edit mode, simply send the DB's value for that field to the check box control.
 

Users who are viewing this thread

Back
Top Bottom