Solved

Actioning vbNo ad well as vbYes on msgbox.

Posted on 2013-11-04
3
297 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
Comment Utility
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 48

Expert Comment

by:Rgonzo1971
Comment Utility
@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
Comment Utility
mbizup.... right on the money, thanks.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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