Results 1 to 7 of 7
  1. #1
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37

    Sub Form Problem

    Hello,

    I have a subform that is hidden, with a cmd button that makes it visible.

    This subform lists critical spares for machines. Each record on the main form is for a particular machine. When a new record is selected, the subform updates to show the critical spares applicable to that machine.


    The issue is as follows,

    When the cmd button is pressed to show critical spares, the subform is made visible. If the user then goes to the next record, the subform remains visible.
    I do not want that to happen, I would prefer it if it was hidden again until the cmd button was once again pressed.

    Database4DocmdOpenForminDialogWorking 19 54pm_2015-07-25.zip

    The main form is frm_prev maints.

    You will see my problem when you make the subform visible, and then go to another record - its still visible.

    Any help or advice is appreciated, thank you

  2. #2
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    Does this do what you want?

    Private Sub Form_Current()
    Me.[SubFrmCriticalSpares].Visible = False

    End Sub

  3. #3
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37
    thanks for your reply,

    In short, no.

    Went a little haywire.

    Came up with an "Invalid outside procedure"

    Rek

  4. #4
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    this subroutine, "Private Sub Form_Current()"
    was already in your form, but empty.
    all I did was add
    Me.[SubFrmCriticalSpares].Visible = False

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    James placed it in a procedure...the Form_Current() procedure! The

    Code:
    Private Sub Form_Current()
      Me.[SubFrmCriticalSpares].Visible = False
    End Sub

    has to be in the code window for the Main Form...not the Subform.

    And, when placed there, in the file you attached, his code works as intended!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37
    Aah, yes - I looked at the Private Sub Form and assumed the code needed to be in the subform.

    It works! thank you both.

    Now all I need to do is plough the sub form etc into my main database and its pretty much there.

    Rek

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Glad we could help!

    Good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 8
    Last Post: 07-03-2015, 05:03 PM
  2. Replies: 6
    Last Post: 01-06-2015, 12:37 PM
  3. Replies: 10
    Last Post: 10-22-2013, 07:35 AM
  4. Form problem
    By donnan33 in forum Forms
    Replies: 1
    Last Post: 01-17-2012, 10:45 AM
  5. Replies: 2
    Last Post: 06-14-2010, 03:25 PM

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