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

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
 
F

fredg

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
 
A

Anthony Dowd

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top