Wait for DoCmd.OpenForm

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wquatan
    New Member
    • Oct 2007
    • 48

    Wait for DoCmd.OpenForm

    I have a form with a button, launching (OnClick event) a Sub which contains
    - DoCmd.OpenForm
    - MsgBox

    Is there a way to wait after the DoCmd.OpenForm till the form is closed again ?

    Thx
  • JustJim
    Recognized Expert Contributor
    • May 2007
    • 407

    #2
    Originally posted by wquatan
    I have a form with a button, launching (OnClick event) a Sub which contains
    - DoCmd.OpenForm
    - MsgBox

    Is there a way to wait after the DoCmd.OpenForm till the form is closed again ?

    Thx
    Hi,
    Not sure if I understand this one. Do you want the form to close automatically after a certain amount of time?

    Explain a bit more and we'll see if we can help you.

    Jim

    Comment

    • wquatan
      New Member
      • Oct 2007
      • 48

      #3
      Originally posted by JustJim
      Hi,
      Not sure if I understand this one. Do you want the form to close automatically after a certain amount of time?

      Explain a bit more and we'll see if we can help you.

      Jim
      Hi,

      When the button is clicked
      - the OncLick events launches the sub
      - in that sub, the docmd.openform is executed, the form opened
      - next the MsgBox in the sub after the DoCmd.openform) is executed immedeatly

      I am looking for a way to postpone the execution of the MsgBox till the form has been closed

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        You need to open the form in Dialog mode:

        DoCmd.OpenForm "Your Form Name", , , , , acDialog

        Linq ;0)>

        Comment

        • wquatan
          New Member
          • Oct 2007
          • 48

          #5
          Originally posted by missinglinq
          You need to open the form in Dialog mode:

          DoCmd.OpenForm "Your Form Name", , , , , acDialog

          Linq ;0)>
          Thx

          I itried that before, but doesn't work. The MsgBox still gets executed immedeatly.
          The only difference I see : with acDialog the form is opened as a DataSheet.

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            For a form to be opened in Datasheet view, you have to have told Access to do this, in your DoCmd.OpenForm command! Using acDialog doesn't do this. And if you've done this, the acDialog argument won't delay the code for the messagebox from executing, because you can't open a form in both Datasheet and acDialog. If you have to
            open this form in Datasheet view I'm afraid you're stuck!

            If you didn't intentionally open the form in Datasheet view, post your code here for us to look at.

            Linq ;0)>

            Comment

            • wquatan
              New Member
              • Oct 2007
              • 48

              #7
              Originally posted by missinglinq
              For a form to be opened in Datasheet view, you have to have told Access to do this, in your DoCmd.OpenForm command! Using acDialog doesn't do this. And if you've done this, the acDialog argument won't delay the code for the messagebox from executing, because you can't open a form in both Datasheet and acDialog. If you have to
              open this form in Datasheet view I'm afraid you're stuck!

              If you didn't intentionally open the form in Datasheet view, post your code here for us to look at.

              Linq ;0)>
              Hi,

              The form I want to open is not a Datasheet when opened directly
              I do not want to open as a Datasheet

              The sub (initiated by clicking a button on another form) contains :

              Private Sub EditEmailServic es_Click()
              DoCmd.OpenForm "Form1", acDialog
              MsgBox "MAINBACK" --> gets executed immedeatly
              End Sub

              Comment

              • wquatan
                New Member
                • Oct 2007
                • 48

                #8
                Sorry !

                Stupid me !
                The number of "," wasn't correct !

                Thanks for helping !

                Comment

                Working...