Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Form mid-code then return (Access 2000)

    While my code is running, I want to open a form on which the user makes some selections to update a table (to determine who shall receive the email). Then I want my code to continue, as it will then read from the table just updated.

    How can I halt my code to call another form, then return to my code again?

    Thanks in advance.

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Open Form mid-code then return (Access 2000)

    As long as you open the form as a dialog type form. This forces the called form to execute completely first before returning to the calling form. Then just open a recordset for the table just updated to get the latest data.
    If I have misconstrued your problem please post back.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Form mid-code then return (Access 2000)

    Do you mean using the code: DoCmd.OpenForm "Ssend", , , , , acDialog

    Unfortunately my code still skips through it.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Open Form mid-code then return (Access 2000)

    >>Unfortunately my code still skips through it.
    What do you mean by this?

    Is this code in a form currently that calls the other form?

    The whole point of the acDialog is that the form must exit back to the calling form before the calling form can continue?

  5. #5
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Form mid-code then return (Access 2000)

    Thanks for your assistance.
    I've discovered that normally the method you suggested works fine. However I also have a 'catch all' situation which is designed to call the "ssend" form when the main form is closed if certain criteria are met.
    So I have a 'Close form' button on the main form which checks for the criteria, then calls the same code, then closes the main form.

    However, the 'Close form' code closes the main form without waiting for the information from the called screen, "Ssend".
    Let me demo:

    Code from the button that works and does not close the form:
    Private Sub Auditme()
    Call fssend 'This calls a form using the code: DoCmd.OpenForm "ssend"
    semail 'This sends the email which is fine
    End Sub

    Code from the Close button that closes the form before the called form is read:
    Private Sub Close_Click()
    Auditme
    DoCmd.Close
    End Sub

    So the only difference I can see is the docmd.close statement on the main form which occurs after everything else so I cannot see why it doesn't work - it's as if Access looks ahead and says "hey, you want me to close this main form? Sure thing, how about I save us some time and do it now!"

    If you can help I'd be very grateful!

    Thanks again.

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Open Form mid-code then return (Access 2000)

    >>Call fssend 'This calls a form using the code: DoCmd.OpenForm "ssend"
    Does DoCmd.OpenForm "ssend" contain the parameter acDialog?
    Where does the code fssend reside?

  7. #7
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Form mid-code then return (Access 2000)

    Thanks, Pat - you highlighted my error. *slaps forehead*
    In this instance I had omitted the acdialog parameter.

    Thanks all for your help.

Posting Permissions

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