Solved

MsgBox loop

Posted on 2007-03-24
3
761 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access query with left expression 9 31
Change AD password via MS Access DB 2 19
Library not Registered 16 49
How to base a filter depending on fields contents? 15 48
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…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now