Solved

avoid question message box

Posted on 2014-02-05
3
303 Views
Last Modified: 2014-02-22
hi, in the below code, how can we avoid the question and still do a full processing? (there is no decision making needed anymore.. the equivalent of "Yes" should be the default.. can you suggest how this code should be changed to accomplish this? thanks-
=============================
 Dim msg As String
  msg = "Would you like to process all (" + LTrim(Str(NumRecsToDo)) + ") records for: " + _
         Chr(13) + Chr(10) + Chr(13) + Chr(10) + Sender1 + IIf(Len(Sender2), " ," + Sender2, "")
  Response = MsgBox(msg, vbYesNoCancel + vbQuestion, "Process Confirmation")
  Select Case Response
    Case 6
      'Process All Records
      LabNum = 0
    Case 7
      Set db = CurrentDb()
      RecSource = "AFRTesting Where Report_Num = '" + ReportNum + "';"
      Set Ds2 = db.OpenRecordset("Select * From " + RecSource, dbOpenDynaset)
      Ds2.MoveLast
      NumRecsToDo = Ds2.RecordCount
 
    Case 2
      MsgBox "AFR Report Request Cancelled By User"
      Exit Sub
  End Select
0
Comment
Question by:25112
3 Comments
 
LVL 49

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 167 total points
ID: 39838042
Hi,

pls try

Dim msg As String
  msg = "Would you like to process all (" + LTrim(Str(NumRecsToDo)) + ") records for: " + _
         Chr(13) + Chr(10) + Chr(13) + Chr(10) + Sender1 + IIf(Len(Sender2), " ," + Sender2, "")
  Response = MsgBox(msg, vbOKCancel + vbQuestion, "Process Confirmation")
  Select Case Response
    Case 1
      'Process All Records
      LabNum = 0
    Case 2
      MsgBox "AFR Report Request Cancelled By User"
      Exit Sub
  End Select

Open in new window


if you want no MsgBox

use
LabNum = 0

Open in new window

Regards
0
 
LVL 19

Assisted Solution

by:MINDSUPERB
MINDSUPERB earned 166 total points
ID: 39838058
Hello 25112,

I may suggest to comment out all those code (I mean all that you posted) and run it. You may delete them later once it gives you what you want.

Those codes as I understand are used in the question message that you don't like to appear.

Sincerely,

Ed
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 167 total points
ID: 39838147
Well, vbYes is 6 so remove all your code and leave this:

      'Process All Records
      LabNum = 0

That's all for a default Yes.

/gustav
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

911 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

15 Experts available now in Live!

Get 1:1 Help Now