Results 1 to 5 of 5
  1. #1
    ccchan is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Location
    Philippines
    Posts
    11

    Close Dialog Box instead of Close App

    Hello!

    I'm trying to modify a code:

    Private Sub cmdExit_Click()
    Response = MsgBox("Do want to close this application?", vbYesNo + vbQuestion, "Quit Application")


    If Response = vbYes Then
    Application.Quit
    End If
    End Sub

    This code actually closes MS Access. I only want to close the dialog box connected to the code. How am I supposed to modify the code?

    Thanks a lot!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Application.Quit
    This is telling Access to QUIT.

    Try replacing that line with

    Me.Close

    BUT Your question/message is

    Do want to close this application? Did you mean to say Do want to close this Form?

  3. #3
    ccchan is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Location
    Philippines
    Posts
    11
    Oh, yes. Form.

    Sorry, Me.Close didn't work.
    Msg Box says:

    Compile Error
    Method or data member not found

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Ok, try Docmd.close Me

    Post back

  5. #5
    ccchan is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Location
    Philippines
    Posts
    11
    I tried DoCmd.Close

    ​it worked! Thank you so much!!!!!! =)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-31-2014, 11:47 AM
  2. Close Button
    By cbrsix in forum Programming
    Replies: 7
    Last Post: 07-30-2012, 09:23 AM
  3. Save and close
    By brobb56 in forum Forms
    Replies: 4
    Last Post: 10-10-2011, 03:07 PM
  4. Replies: 2
    Last Post: 06-20-2011, 03:10 PM
  5. Close All but One Form
    By Bruce in forum Forms
    Replies: 4
    Last Post: 04-06-2010, 09:31 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums