Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

avoid question message box

Posted on 2014-02-05
3
Medium Priority
?
311 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 53

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 668 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 664 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 52

Accepted Solution

by:
Gustav Brock earned 668 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
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.

876 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