Solved

MsgBox loop

Posted on 2007-03-24
3
782 Views
Last Modified: 2013-11-27
I am looping thru a recordset and updating based upon record flag checkbox.  I have a message box confirming prior to the update but it fires for every record that will be updated.  

Question:  Is there a way to code the message so that it will only fire once (for the group of records to be updated)?
0
Comment
Question by:zubin6220
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 300 total points
ID: 18785037
Place your message box statement before the loop (something like this)...

If MsgBox("Do You Want to Update These Records?, vbYesNo) = vbYes  Then
    Do until rs.EOF
          ....
          ...
     Loop
End if
'Your other code here


If the loop is all that is left in the procedure, you can get by without a block If statement and simplify it to:


If MsgBox("Do You Want to Update These Records?, vbYesNo) = vbNo  Then Exit Sub '** or exit function
Do until rs.EOF
          ....
          ...
Loop
End Sub
0
 

Author Comment

by:zubin6220
ID: 18785089
Yeah, that makes sense.  Thanks
0
 
LVL 61

Expert Comment

by:mbizup
ID: 18787953
Glad to help :-)
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question