Results 1 to 4 of 4
  1. #1
    faythe1215 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    52

    Making code wait/pause until event

    I have a form with a button that opens up a pop up form. Once the user enters the necessary information in the pop up, it's set to close.



    I'd like to be able to come back to the original form and continue executing code once the pop up closes.

    Code:
        DoCmd.OpenForm "frmItemAdd"
        Forms!frmItemAdd.SetFocus
        DoCmd.GoToRecord , , acNewRec
        Forms!frmItemAdd.AllowEdits = True
        
        ' This code kind of just needs to just sit here and wait until "frmItemAdd" closes.
        
        ' I have more code I'd like to execute here

  2. #2
    A S MANN is offline Advanced System Analyst
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    India
    Posts
    161
    add a button "close" to frmItemAdd form and add on click event
    Docmd.Close "frmItemAdd"
    DoCmd.OpenForm "original form"

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You will likely have to add a timer that checks to see if your pop up form is still open every few seconds then when it's no longer open continue with your code. Or follow this advice:

    http://bytes.com/topic/access/answer...il-form-closes and set the secondary form to DIALOG which will force the code to wait (at least from what I've read)

  4. #4
    faythe1215 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    52
    All right, related problem.

    The information entered into the second form (now dialog box) should, once it's closed, be accessible by the first form. It is not. I have tried Me.Refresh, and had no luck. I have also tried to DoCmd.Requery and not only does it take me back to the first record (which I'm sure I could change with a bit more coding) but it also does not actually refresh the information the way I described anyway.

    Wait... The field I am trying to refresh belongs to a subform. *Sorry, I know that I'm actually thinking out loud now*

    Is there a way to requery or refresh that form/field on the subform from my main form? - Never mind -

    You guys can go ahead and set this to solved while I kick myself for my n00bs.
    Last edited by faythe1215; 02-09-2015 at 03:58 PM. Reason: Tried other things...

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

Similar Threads

  1. Pause / Wait / Countdown / Timer
    By DevGreg in forum Programming
    Replies: 2
    Last Post: 07-19-2022, 06:30 AM
  2. Pause code until return from call command
    By trevor40 in forum Programming
    Replies: 1
    Last Post: 03-08-2014, 05:08 AM
  3. Replies: 7
    Last Post: 05-28-2013, 09:11 AM
  4. Making sure code runs regardless
    By nvrwrkn in forum Programming
    Replies: 2
    Last Post: 10-09-2012, 11:39 AM
  5. Replies: 5
    Last Post: 02-08-2011, 11:17 AM

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