Making Subform Visible On One record Only

B

Brian

I have an invoice form with a check box which when =True executes a macro to
make a subform visible for additional entries.
Although the macro works, when run, it displays the subform on ALL records
even those records where the check box remains =False.
I only want the subform visble on Check Box=True records.
The check Box is a bound Control in the underlying table.
I've tried various solutions but not got it working yet.

Gordon
 
T

Tom van Stiphout

On Wed, 17 Mar 2010 13:23:01 -0700, Brian

You can use this one-liner in the Form_Current event:
Me.mySubformControl.Visible = Me.myCheckboxField
(of course you replace myObjectNames with yours)

-Tom.
Microsoft Access MVP
 
S

SuzyQ

go to the properties for the subform in you main form and set visible to false,

then in the on change event for you check box put the following code

Private Sub checkBoxName_AfterUpdate()
If Me.checkBoxName = True Then
Me.[childFormName].Visible = True
Else
Me.[childFormName].Visible = False
End If
End Sub

I tested this and it does what it seems like you are explaining in your post.
 

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