Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MsgBox loop

Posted on 2007-03-24
3
Medium Priority
?
818 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

609 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