[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1420
  • 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 MVP, Access and Data Platform)Commented:


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

mx
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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 MVP, Access and Data Platform)Commented:
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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