Results 1 to 6 of 6

Pausing code until a condition is met

  1. #1
    S2000magician is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    31

    Pausing code until a condition is met

    I have a list of data that I want to present to the user one at a time; the user can accept, reject, or modify each item.

    I have a loop that will run through the data items, but I need to pause the loop each time until the user performs some action.



    What's the best way to pause the code until the user's done whatever he's going to do?

    Thanks, as always!

  2. #2
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    1,973
    Use 2 forms, a control form and an action (modal) form.
    The control form would have the loop code present the data to the action form via its recordsource. The recordsource would be a query with criteria pulled off the control form.
    The loop would set the data up, then just before the .MoveNext, open the modal form.
    The modal form would let the user do whatever, then close itself.
    Execution would return to the code in the control form where the next instruction is .MoveNext: Loop.
    Last edited by davegri; 09-09-2019 at 02:46 PM. Reason: calif, sp

  3. #3
    S2000magician is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    31
    Can it be done in a single form?

    I'd rather not use two forms if I don't have to.

  4. #4
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    1,973
    I'd rather not use two forms if I don't have to.
    Don't see how. Even if you could stop code execution, if the code is stopped, how could it respond to anything to start again?
    Maybe someone else has a workaround...

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,103
    Quote Originally Posted by S2000magician View Post
    Can it be done in a single form?
    I'd rather not use two forms if I don't have to.
    I'd say no as well. The list navigation would have to be separated from the user action because the only way to stop the list navigation from progressing is to open the user input form as modal. You cannot make some part of a particular form behave in a modal fashion AFAIK.
    What could possibly be the reason for not wanting a second form for this? Usually, people have too many forms for doing basically the same thing.
    EDIT
    IF you only wanted 1 of 2 or 3 options you could use a message box, but because you included modifying an item, that would not work - unless you can modify via an input box. Both the input and message boxes are built in 'forms' that you would not have to create.
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.
    (humor about talking to yourself apparently was too much for some)

  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    14,102

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

Similar Threads

  1. Pausing code on one form until another form is closed?
    By S2000magician in forum Programming
    Replies: 3
    Last Post: 08-17-2019, 10:05 PM
  2. acDialog not pausing code
    By mredmond13 in forum Programming
    Replies: 8
    Last Post: 07-08-2018, 01:31 PM
  3. Replies: 19
    Last Post: 08-24-2016, 01:46 PM
  4. Replies: 5
    Last Post: 10-07-2014, 09:20 AM
  5. Replies: 2
    Last Post: 12-14-2013, 08:40 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
  •  
Tech Forums: Microsoft Office Forums