Solved

avoid question message box

Posted on 2014-02-05
3
302 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 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 167 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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.

744 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

17 Experts available now in Live!

Get 1:1 Help Now