Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006
    Posts
    23

    Unanswered: Exit Application

    Hi Guys,

    hopefully a relatively simple query, i have used the MS access to build 'exit' buttons on forms, for a quick exit away from the application, however as you probably no, MS Access quits without a confirmation or warning.

    I have tried to get around this by using the following code

    Code:
    MsgBox "Are you sure you want to quit?", vbYesNo, "Required Data"
        If vbYes Then
        MsgBox "Returning to Form"
        If vbNo Then
        MsgBox "quit"
        'DoCmd.Quit
          
        End If
        End If
    However, both msgbox's are returned, when either 'Yes' or 'No' is clicked... is there anyway to get around this? Many thanks in advance,

    Ross

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    vbYes and vbNo are constants, respectively holding the values 6 and 7, which evaluates to true in your statements. What you need to do, is assign the value to a variable

    dim intAnswer as integer
    intAnswer = msgbox("wanna quit", vbyesno)
    if intAnswer = vbYes then
    application.quit
    else
    msgbox "return to form"
    end if

    alternatively

    if msgbox("wanna quit", vbyesno) = vbyes then
    Roy-Vidar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •