hide subform and show with command button

J

JasonP

I am pretty new with Access, and cannot figure this out. I have a form (Call
Record) and a subform (Sales Lead). Not all of the calls turn into sales
leads, so I don't need that subform visible all the time. I would like to
hide the subform and set up a command button that will make it visible when I
need it.. Then, when I go to the next call, it will go away.

I read a post earlier that stated I could change the visible properties in
the event tab by clicking on the "on current" field and entering a code. I
do not see the "on current" field, only on click, on enter, etc. Am I
looking in the wrong place? How do I make this work. Any help is
appreciated. Thanks
 
R

Ryan

The code would look like this

Private Sub Form_Current()
Me.Sales_Lead.Visible=False
End Sub

Then for the command button the code would look like this. (You would need
to name your command button ShowSalesLeads)

Private Sub ShowSalesLeads_Click
Me.Sales_Lead.Visible=True
End Sub

Hope this helps
 
J

JasonP

Perfect! That worked. Thank you

Ryan said:
The code would look like this

Private Sub Form_Current()
Me.Sales_Lead.Visible=False
End Sub

Then for the command button the code would look like this. (You would need
to name your command button ShowSalesLeads)

Private Sub ShowSalesLeads_Click
Me.Sales_Lead.Visible=True
End Sub

Hope this helps
 

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