Hiding/showing subforms

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hi, all

I have a form with a subform that I would like to be invisible until
required by the user. I have looked in the macros and been unable to find
anything that deals with subforms, and I've never used VBA before, so I seem
to be stuck. Does anybody know of a way to do this?

Thanks, David
 
Here is some code that you can put in the current event of the main form if
you want the subform to appear with a new record on the main form:

If Not IsNull(Me.YourMainFormID) Then
Me.YoursubfrmName.Visible = True

Else
Me.YoursubfrmName.Visible = False

End If

Another way, if you want the user to choose, would be to have a button on
the main form, and the click event would be similar to above :
Me.YoursubfrmName.Visible = True

Note that the subform is already on the mainform - at design level just set
its visible property to false

Damon
 

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

Similar Threads

Access Reference Subform's Control 0
Hide Controls on Subform 2
Subform Data Entry Setting 0
Hide 0 records subform to reveal txtbox underneath 6
I cann't fill in a subform 1
Subform Requery Criteria 1
Toggle Button 1
SubForms 4

Back
Top