Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338

    Open form within a form

    Hello



    How can i open a form within another form??? Please see attachment


    KMBT22220121017043110.pdf

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The big box would be a subform control. The code behind the buttons would set its Source Object property to the desired form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Pbaldy

    Thank you for your reply. I'm still new to access. Where can i find out more info about this???

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The code would look like:

    Forms!FormName.SubformControlName.SourceObject = "DesiredFormName"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    I try this but it didn't work.

    Private Sub Command10_Click()


    Forms![F_LockBoxMainForm]![Child7]!SourceObject = "zzForm1"

    End Sub

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    db1.mdb

    Thank you

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'm confused (not uncommon). You have the code in zzForm1, but trying to set the subform container of another form to zzForm1. Typically I'd expect a single main form with a subform container. Buttons on that main form would change/set the subform container.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    I'm very confused. Not sure if we are on the same page.

    ZZForm1 would be the Main form. The main form would have 5 buttons. Everytime the user would click on any of the buttons the form would open withing the main form.

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    But it would typically be a different form being opened within. In other words, I might have the form name "Main", I might set a subform within to a form named "Customers", then have another button to switch it to "Orders", or whatever. You have code within zzForm1 to set the subform in the other form, F_LockBoxMainForm. I guess I'm confused as to what you're trying to achieve.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    I guess i was doing it wrong. So forget what i did.

    What you stated in post 10 is what i want.

    Main", I might set a subform within to a form named "Customers", then have another button to switch it to "Orders", or whatever

    How can i go about this?????

    Thank you

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    zzForm1 was basically set up correctly, but the code behind each button would refer to its subform instead of the other form's:

    Me.Child7.SourceObject = "FormName"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    That worked great. One more thing.
    What would be the code to close the form?
    Not the main form.

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    If you want to empty the subform so that there's nothing in it, try

    Me.Child7.SourceObject = ""
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Thank you very much.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-11-2012, 11:52 AM
  2. Replies: 1
    Last Post: 05-03-2012, 02:25 PM
  3. Replies: 11
    Last Post: 01-26-2012, 01:22 PM
  4. Replies: 1
    Last Post: 12-04-2011, 09:11 PM
  5. Replies: 2
    Last Post: 02-26-2010, 08:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums