• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1425
  • Last Modified:

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

0
NotEnoughTime
Asked:
NotEnoughTime
  • 4
  • 3
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:


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

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Private Sub Command1_Click()
   'Toggle the visibility of the subform
    If Me.YourSubFormControlName.Form.Visible = True Then
        Me.YourSubFormControlName.Form.Visible = False
    Else
        Me.YourSubFormControlName.Form.Visible = True
    End If
End Sub

mx
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
NotEnoughTimeAuthor Commented:
thank you everyone,
I am going to try DatabaseMX's code first, it seems the easiest
I will let you know
Thank you
0
 
NotEnoughTimeAuthor Commented:
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

0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
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
0
 
NotEnoughTimeAuthor Commented:
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?
0
 
NotEnoughTimeAuthor Commented:
disregard last post
it works, my access got hung up for a moment I restarted and it is fine

thanks so much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now