Link to home
Start Free TrialLog in
Avatar of NotEnoughTime
NotEnoughTime

asked on

Subform visible or hidden

Is there a way to have a subform be hidden on the form, and create a button to show the subform when needed,
I have tried to make a subform a popup, but the parent child link just isn't there when you want to add a record to the subform. It will show existing records, but won't let you add a record. (can't get the autonumber ID on the main form to fill in on the subform)
I would prefer not to use a second tab control if I can help it. the subform collects phone call information that needs to stay linked to the main form, but takes up too much space when it isn't needed.
Any suggestions would really be appreciated
MS access 2003 - windows XP Pro
Thank you
-C

Avatar of puppydogbuddy
puppydogbuddy

Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)


Private Sub Command1_Click()
     Me.YourSubFormControlName.Form.Visible = False ' or True
End Sub

mx
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NotEnoughTime

ASKER

thank you everyone,
I am going to try DatabaseMX's code first, it seems the easiest
I will let you know
Thank you
mx
thanks so much, code worked great! I can now fit two suborms in the space for one by overlaying them ontop one another
Thank you

You are certainly welcome.

btw ... you can also add some code in there to toggle the Caption on the command button, ie Show/Hide or whatever makes sense.

mx
I think I may have closed this question out a bit soon, If I need to repost I can, please let me know,

when the main form opens the subforms are showing
I would like them to be hidden when form opens, click button to show them then click again to close them If I make subform not visisble on form properties, i cannot get them to close when I clik on the button again
is this possible?
disregard last post
it works, my access got hung up for a moment I restarted and it is fine

thanks so much