• Strange autoexec behaviour (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Strange autoexec behaviour (Access 2000)

    Author
    Topic
    #367159

    I have a database which through the autoexec does some jobs and then closes itself.
    The jobs contained in the coding are performed, but on closing the database the message apears “cannot find the path of the database.”. I cannot explain myself this strange behaviour. CAn i somehow avoid this message and have the database properly closed?
    I will try to list in short what the database is doing:
    The autoexec macro runs the function called FncAuto. The role of the function FncAuto is to open the form frmDump.In the OnOpen event of the form i have the function called FncMakeUp. The function FncMakeUp imports some tables, and does some appendings and processings.At the end i have the Command Application.Quit.
    And then the message appears and the database is not closed properly.
    I will be very grateful for any advice on this subject.

    Viewing 0 reply threads
    Author
    Replies
    • #571711

      It sounds like your event code may be stepping on itself. The code is trying to address the database after you issued the application.quit, possibly in the Close event of the form.

      • #571755

        Thank you for your reply. Yes, i think something has to do with my code.And also that the query continues running after i want to close the database.But can i avoid that?Is there any other command beside Application.Quit that can do the job? I am opening the form just to avoid the malfunction of the macro. But with no success.If i put my autoexec macro to perfrom only the the makeup function, then i receive the same results, the function has done its job,but just on exit i receive the message that the database
        cannot be found.For example, if i put the function MakeUp on the OnClick event of the form, then everything is O.Ok, the function perdorms easility and the database is closed. But not if i use autoexec macro.I do not want to use the StartUp option becasuse of some reasons connected with my coding. So it follows that my problem lies with the autoexec macro and the Application.quit statement.I hope
        i am making some mistakes in my arranged code or you might show me some other way to close the database through the autoexec macro.I will be very grateful to you indeed.
        Best regards

        • #571856

          I don’t see why you would prefer an autoexec macro to opening a form at startup. You can error trap the code in your form and you can also put lines of code in to destroy the querydef object. If the code performs properly when run from the form’s OnClick event but not when run from its OnOpen event, then it’s a timing issue. Access doesn’t necessarily finish things like running a query before it proceeds to the next line of code. What you may have to do is modify your code so that it keeps testing for a result before it proceeds on to the line that quits the application.

          • #571915

            Thank you so much for your wish to help.I think you will be able to help me if I send to you my abridged database.In short, the autoexec macro runs a code that opens a form and in the OnOpen event of the form is my function.I have simplified it so that the function, for more clarity, contains only the command DoCmd.Beep. So what I want is that aftewr performing the function, in this case DoCmd.Beep, to quit the application and close the database.But at the end I receive the message

            • #572050

              I’d like to help, but I don’t get any message on my machine. Is it possible that the path for the DAO library is incorrect on that machine and that’s what’s throwing the message? If the DAO 3.6 library doesn’t exist or the path is incorrect, you should get a file not found error.

              I don’t see why you’re using a form at all in this database unless you use it to display some kind of “Working” message while you other things behind the scenes. If all the database is doing is trying to set a reference, you don’t need a form. Just call the code routine like this:

              Public Function Autoexec()
              AddDAO
              Call Up
              End Function

              You could even stick the Application.Quit in the Autoexec function after the call to the Up function.

              Incidentally, unless the AllowBypassKey has been disabled in the database, all you need do to bypass an autoexec macro is to hold down the shift key as you open the database.

    Viewing 0 reply threads
    Reply To: Strange autoexec behaviour (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: