Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Thanked 0 Times in 0 Posts

    Closing database effectively (Access 2000)

    How to close the database effectively

    In the autoexec code of a database i have placed a condition that
    the dataabse will be opened only if a certain database is available.
    If the database FrontEnd is not available,then i want the database not to be opened at all.
    My code is the following:

    If Dir("C:beFrontEnd.mdb ") = "" Then
    cancel = true
    Application.Quit acPrompt
    DoCmd.OpenForm " FDepot"

    However, if the database FrontEnd is not available, the database is not closed,
    as i want it,nor the cancel command works.Instead i receive the following message:
    " cannot find the file.Make sure the path and filename are correct"

    The database is not opened in this case, but it is not closed effectively and i want that
    nobody opens the database in case that the database FrontEnd is not available.
    Also i do not want that any message for an error appears,but simply to close or not to open the dataabse.
    In a nutshell i want that the database does not open at all if the other dataabse is not present.
    Can somebody help me?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Closing database effectively (Access 2000)

    Which database are you trying to run this code from? What event are you cancelling? Do you have any error handling to trap the error when the file or folder doesn't exist?

Posting Permissions

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