+ Reply to Thread
Results 1 to 4 of 4

set .Visible = True on Subform, From Another Subform

  1. #1
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    set .Visible = True on Subform, From Another Subform

    I have a "master" form which contains a few subforms that are shown or hidden depending on the context of the master form (which options are selected, etc.).

    In one subform, the user enters audit information. I attempting to make the AfterUpdate subroutine set on that subform to hide itself and show another subform. There is a button on the master form that does just this, but I want it to do it automatically when the user updates the record. I just can't seem to get it to work, though.

    Please Login or Register  to view this content.
    Me.Parent.cmdPostClosingMemo_Click looks like this:
    Please Login or Register  to view this content.
    The cmdPostClosingMemo_Click subroutine runs, because the lblTitle lable changes, but the subforms do not hide/unhide.

    I've played around with the syntax, done oodles of Google searches, etc. Can someone help me out?

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: set .Visible = True on Subform, From Another Subform

    I'm not too familiar with the use of subforms, but does it work if you set the focus on the PostClosingMemo subform first?

    Is there an error, or does it just not do what you want it to?
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: set .Visible = True on Subform, From Another Subform

    Me.Parent.SetFocus does not work. Neither does Me.Parent.cmdPostClosingMemo.SetFocus. It changes the lblTitle.Caption, but just doers not hide/unhide the subforms.

    Looking at this site (http://access.mvps.org/access/forms/frm0031.htm) I am thinking maybe it is not possible to control a subform from another subform. The "To refer to a subform control property, like SourceObject" section has N/A if you are on the parent form or any subform. If this is the case, I can't imagine what the reason is. Should I SetFocus on another for briefly and have that form's "SetFocus" event do the work?

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: set .Visible = True on Subform, From Another Subform

    Can you just avoid the descendant issue by jumping to the form by name?:

    Please Login or Register  to view this content.
    The subform would have to be visible before you can set the focus.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1