Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004

    Unanswered: OpenDatabase: Couldn't find file

    Is is possible to use OpenDatabase without an absolute path?

    I have a database called Search.mdb that uses the records from Publications.mdb but when I use:


    Dim db as Database

    Set db = OpenDatabase("Publications.mdb")

    I get an error message -> Couldn't find file 'Publications.mdb' but when I put in the full path, it works. How can I get around putting in the full path?

  2. #2
    Join Date
    Feb 2004
    Chicago, IL
    Where is the code running? In Search.mdb? Are the two databases in the same location? If the Publications database is in the same folder you can get the current path of the Search database using either:

    CurrentDB().Name or CodeDB().Name

    This returns the Search databases path and filename. Then you can strip off the filename and append the path to "Publications.mdb" and that should work.

    Another approach which I have also used is to put the path of the database into a table and then write a function to retrieve it. That way when you change the database's location you just have to change the path in the table.

  3. #3
    Join Date
    Feb 2004
    This database and search form are going to be distributed to our clients so I have no control over the drive or folder that they will be installing it to.

    I am curious about the CurrentDB().Name method you elude to: how would you use it?

Posting Permissions

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