Updating the contents of a text box when ticking/unticking a check box

  • Thread starter Thread starter Anthony Dowd
  • Start date Start date
A

Anthony Dowd

Hi

I have a form with a check box callled 'NoAppt' which when ticked, places a
value in a field (ie a text box) called 'NoAppt1' in the underlying table as
shown in the code below. This works fine when ticking the check box, but I
want the text in 'NoAppt1' to be deleted when unticking the check box. There
seems to be no Change Event for check boxes.
*****************************************
Private Sub Check68_BeforeUpdate(Cancel As Integer)
If (IsNull(Forms![Patient Details]![NoAppt])) Then
Forms![Patient Details]![NoAppt1] = ""
Else
Forms![Patient Details]![NoAppt1] = "Please call the surgery to make
an appointment"
End If
End Sub
*******************************************

Any suggestions?

Thanks
anthony
 
Hi

I have a form with a check box callled 'NoAppt' which when ticked, places a
value in a field (ie a text box) called 'NoAppt1' in the underlying table as
shown in the code below. This works fine when ticking the check box, but I
want the text in 'NoAppt1' to be deleted when unticking the check box. There
seems to be no Change Event for check boxes.
*****************************************
Private Sub Check68_BeforeUpdate(Cancel As Integer)
If (IsNull(Forms![Patient Details]![NoAppt])) Then
Forms![Patient Details]![NoAppt1] = ""
Else
Forms![Patient Details]![NoAppt1] = "Please call the surgery to make
an appointment"
End If
End Sub
*******************************************

Any suggestions?

Thanks
anthony

You should be using the Check box AfterUpdate event:

If Me![CheckBoxName] = True then
Do this
Else
Do That
End if
 
Thanks Fred. That works fine.

Anthony

fredg said:
Hi

I have a form with a check box callled 'NoAppt' which when ticked, places a
value in a field (ie a text box) called 'NoAppt1' in the underlying table as
shown in the code below. This works fine when ticking the check box, but I
want the text in 'NoAppt1' to be deleted when unticking the check box. There
seems to be no Change Event for check boxes.
*****************************************
Private Sub Check68_BeforeUpdate(Cancel As Integer)
If (IsNull(Forms![Patient Details]![NoAppt])) Then
Forms![Patient Details]![NoAppt1] = ""
Else
Forms![Patient Details]![NoAppt1] = "Please call the surgery to make
an appointment"
End If
End Sub
*******************************************

Any suggestions?

Thanks
anthony

You should be using the Check box AfterUpdate event:

If Me![CheckBoxName] = True then
Do this
Else
Do That
End if
 
Back
Top