Back to previous, but now closed, form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stonward
    New Member
    • Jun 2007
    • 145

    Back to previous, but now closed, form

    Okay...no one fancied the last one, eh?! Can anyone help with this....I need a piece of code that allows a form to close then reopens the previous form. I'm sure there's a way, but tho' I love coding, I'm not yet that good at it...getting better every day however! Thanx,

    Stonward
  • Scott Price
    Recognized Expert Top Contributor
    • Jul 2007
    • 1384

    #2
    Not sure what the 'last one/post' was, but your general DoCmd.OpenForm "FormName" in the on close event of your form should work...

    Regards,
    Scott

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      If you don't know what form is the previous form because there are multiple forms that could open it, then pass the form name in the OpenArgs parameter of DoCmd.OpenForm of the previous form.

      Comment

      • stonward
        New Member
        • Jun 2007
        • 145

        #4
        Mmm. Sorry folks, not sure I'm getting it. I cant't NAME the form, because I don't know what form the user will have been using previously. So, when the user closes the current form, I need something to enable the form that was open prior to that one to open? Will OpenArgs do this? Can you show me the syntax? Thanks,

        Stonward Roy.

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          OpenArgs won't do this, it only stores whatever value is passed in it.

          So let's say you have multiple forms, Form1, Form2, Form3. And they can all open Form4.

          Well, when you go to open the Form4 from any one of them, you can use:
          DoCmd.OpenForm "Form4", , , , , , "Formx"
          where x is the originating form.

          Now you have access to that variable using Me.OpenArgs which stores the value of the form. So you can open up the old form using:
          DoCmd.OpenForm Me.OpenArgs

          Comment

          • stonward
            New Member
            • Jun 2007
            • 145

            #6
            Cool!
            Thanks, Rabbit.

            Stonward

            Comment

            • Rabbit
              Recognized Expert MVP
              • Jan 2007
              • 12517

              #7
              Not a problem, good luck.

              Comment

              Working...