subform to appear only if yes checkbox is checked

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that contains client information, including the client's main
address. I have a subform that contains alternate billing address for the
client. Since not all clients have an alternate addresses, I would like this
subform to appear only if the user checks the checkbox stating that there is
an alternate address.

Someone suggested the following, but it's not working. Any suggestions
would be greatly appreciated.

On the after update event of the check box enter the code
Private Sub checkboxName_AfterUpdate()
If me.checkboxName = True then
me.subformName.visible=True
Else
me.SubFormname.visible=False
End if
End Sun
If you open this form to edit records, or just move between records then, on
the on current event of the form call the after update sub that you created.

call checkboxName_AfterUpdate
 
Hi Alicia

Would you like to tell us in what way the code is not working? It looks OK
to me (apart from a typo in "End Sun").

Does it compile? If not, what line is highlighted and with what error
message?

Does it raise a run-time error? If so, what error and what line of code?

Does it just not do anything? If so, check that both the checkbox's
AfterUpdate property and the form's OnCurrent property are set to [Event
Procedure].
 
Back
Top