Still need help with check box/hide subform problem

G

Guest

My original question was how to make a subform visible only when a related
box is checked.

The code for this was given to me by JackP, but for some reason I'm getting
the error message:

The LinkMasterFields property setting has produced this error:'Invalid
outside procedure'

The field name the check box is associated with is "Plumber".
I select the check box, click Properties, Use the Code Builder in After
Update and type the following:


Private Sub Check36_AfterUpdate()
If Me!Plumber = True Then
Me!MembersSubform.Visible = True
Else
Me!MembersSubform.Visible = False
End If

End Sub




Please help.

Thank you!
Blair :)
 
T

Tony Vrolyk

I am not sure if this is causing the error but I do see a problem with your
form. Your check box is bound to the field "Plumber" but the check box is
named Check36. Your code refers to Plumber but I am guessing there is no
control called Plumber. I would rename the checkbox to be called chkPlumber
and then change your code like this. This way you are refering to the
control instead of the field.

Private Sub chkPlumber_AfterUpdate()
If Me!chkPlumber = True Then
Me!MembersSubform.Visible = True
Else
Me!MembersSubform.Visible = False
End If

End Sub

Also you may want to verify that the subform control is named correctly. If
not this may be what is causing the error. When you add a Subform control to
a form you set its control source to be the name of the form itself but the
subform control is probably called something like Subform125. The Subform
control name is on the Other tab of the property sheet. Once you set the
name you should adjust your code to use this name instead of the name of the
form in the subform control.


Hope this help,
Tony V
 
T

Tony Vrolyk

Also on my first point. Depending on the way you replace that code you may
end up with an orphaned procedure called Sub Check36_AfterUpdate(). You
should go through the code on that form and delete it.
 

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