Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Actioning vbNo ad well as vbYes on msgbox.

Posted on 2013-11-04
3
Medium Priority
?
305 Views
Last Modified: 2013-11-04
This is probably quite simple but looking for some guidance. This code works fine and just cancels a given action if the user presses No on the msgbox:

If MsgBox("This quotation will be cancelled and you will be unable to convert it to an an order, nor will it appear on the quotations list. Do you want to continue?", vbQuestion + vbYesNo, "GBIS") = vbYes Then
    Me.orderstatus.Value = "Cancelled"
    MsgBox "This quotation has been cancelled. This screen will now close.", vbInformation, "GBIS"
    DoCmd.Close
    End If
    
GoTo lastline

Open in new window


I want to add something like:

if vbno then me.textbox.value = ""

Just to clear out a text box and abort the actions which are taken when yes is pressed.

All help appreciated.
0
Comment
[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
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 39621427
Try this:

Dim lngResponse
lngResponse = MsgBox("This quotation will be cancelled and you will be unable to convert it to an an order, nor will it appear on the quotations list. Do you want to continue?", vbQuestion + vbYesNo, "GBIS")

Select Case lngResponse 
case  vbYes 
    Me.orderstatus.Value = "Cancelled"
    MsgBox "This quotation has been cancelled. This screen will now close.", vbInformation, "GBIS"
    DoCmd.Close
Case vbNo
    me.textbox.value = ""

Case Else ' User clicked x button
     ' Do something

end select
      
GoTo lastline 

Open in new window

0
 
LVL 53

Expert Comment

by:Rgonzo1971
ID: 39621449
@mbizup

by vbYesNo the Cancel "X" button is disabled no need to implement an else case

Regards
0
 

Author Closing Comment

by:Computer_Support_Norwich
ID: 39621509
mbizup.... right on the money, thanks.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
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…

661 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