Results 1 to 5 of 5
  1. #1
    carmenv323 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Location
    Massachusetts
    Posts
    78

    Make form visible when closing a form

    I have my main form (A) and on it I have a subform (B)


    On my main form A I have a few buttons to open other forms.

    SubForm B is a Request form that i want displayed each time as the default.

    When a user clicks on a button to open another form (pop-up C as acDialog) I Hide Subform B so the current form (C) is the only one in display.

    The issue is that when I close form C, I can't get SubForm B to be visible again.

    On Form C's Close event I have: Forms!SubFormBControlName.Visible = True but it's saying "Object doesn't support this property type or method"

    I put the same code on Form A's SetFocus Event but it doesn't do anything either.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    see this link about how to reference controls on other forms
    http://access.mvps.org/Access/forms/frm0031.htm

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,910
    You would need the mainform name in there as well?
    Ajax's link should confirm that.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    Code:
    On Form C's Close event I have: Forms!SubFormBControlName.Visible = True
    Try

    Forms("FormA").Controls(SubFormBControlName).Visib le = True

    FormA is the name of form A
    SubFormBControlName is the name of the control on Form A holding Form B

  5. #5
    carmenv323 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Location
    Massachusetts
    Posts
    78
    This is what finally worked. Thank you

    Forms!MainForm![SubForm].Visible = True

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-09-2021, 05:52 PM
  2. Return to form and make a control visible
    By shylock in forum Access
    Replies: 9
    Last Post: 11-09-2018, 06:15 PM
  3. Make form visible from VBA code
    By GraeagleBill in forum Programming
    Replies: 6
    Last Post: 12-16-2014, 04:19 PM
  4. Replies: 6
    Last Post: 12-13-2014, 09:20 PM
  5. Replies: 8
    Last Post: 10-26-2012, 09:17 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