Results 1 to 7 of 7
  1. #1
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124

    Error message in application


    Dear All

    I am getting this error message on exit of application:

    Click image for larger version. 

Name:	Untitled.jpg 
Views:	10 
Size:	33.9 KB 
ID:	21586

    I am simply using quit button with a message first which asks whether to exit or not and then getting this message. Although on pressing OK button on this message application does close down. This issue is not there when I am opening and testing database, only happens in the final app.
    Please help guys!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Are you using VBA? I would do something like.
    Code:
    Dim intAnswer As Integer
    intAnswer = MsgBox("Do you want to close the application?", vbQuestion + vbYesNo + vbDefaultButton2, "Exit Now")
    
        If intAnswer = vbYes Then
            Application.DoCmd.Quit
        End If

  3. #3
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124
    Yes I was using slightly different VBA but even with your code the same error message is coming. Although I accept there is a calculative field in my form with calculate the no. of days between 2 dates and the quit button is on the same form, but this is happening even when I have not started putting any data in the form! There is also a switchboard in the application which has same button for quitting the app but when I am quitting from switchboard there is no such error message appearing?

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe it is as simple as closing that form and using another form to run your Quit method from. If you need it all done in one shot, you might be able to use the other form's On Activate or On Current event to execute the Quit Method.

  5. #5
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124
    Hi
    Can you please elaborate?

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    It may be that if the form is closed, you will be able to execute your statement
    Code:
    Application.DoCmd.Quit
    So to close your form, you can use a statement like
    Code:
    docmd.openform "anotherForm",,,,,achidden  'count the commas for the hidden thing (air code)
    docmd.close acform, Me.name
    In the form named "anotherform" you can include the original statement that is likely causing the error. Maybe you can put it in the form's On Load, On Activate, or the On Current event. Maybe bind the form to a small recordset and place the following in the On Current.
    Code:
    Application.DoCmd.Quit

  7. #7
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124
    Thanks for help

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

Similar Threads

  1. Application Defined Error
    By allenjasonbrown@gmail.com in forum Programming
    Replies: 2
    Last Post: 08-06-2015, 06:31 AM
  2. Replies: 5
    Last Post: 05-15-2015, 10:49 AM
  3. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  4. Replies: 7
    Last Post: 07-24-2013, 02:01 PM
  5. Replies: 2
    Last Post: 06-23-2012, 11:59 PM

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