Solved

MsgBox loop

Posted on 2007-03-24
3
751 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
Comment Utility
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
Comment Utility
Yeah, that makes sense.  Thanks
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
Glad to help :-)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

762 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

6 Experts available now in Live!

Get 1:1 Help Now