Solved

Actioning vbNo ad well as vbYes on msgbox.

Posted on 2013-11-04
3
301 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
3 Comments
 
LVL 61

Accepted Solution

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exporting from Access 2016 to a CSV file 4 49
VBA modules import 4 57
Access Change color of current datasheet row. 1 27
2 subforms 1 main form 1 13
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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 …

839 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