Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    17

    Unanswered: VBA: Determine filename of open mdb file at runtime

    I want to select data from an Access query accessed via ADO. However there is a problem:
    I can't hardcode the Access mdb file's filename into an ADO command, so I have to determine the filename at runtime. I know for sure the Access mdb file will be open at runtime, is there any way to determine the filename of the currently opened database for an Access object?

    Thanks a lot

    - S_Scheible

  2. #2
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Re: VBA: Determine filename of open mdb file at runtime

    Originally posted by S_Scheible
    I want to select data from an Access query accessed via ADO. However there is a problem:
    I can't hardcode the Access mdb file's filename into an ADO command, so I have to determine the filename at runtime. I know for sure the Access mdb file will be open at runtime, is there any way to determine the filename of the currently opened database for an Access object?

    Thanks a lot

    - S_Scheible
    CurrentDB.Name ???

  3. #3
    Join Date
    Feb 2004
    Posts
    17
    If I understand this correctly, CurrentDB is part of ADO. However, I don't have the mdb file opened with ADO yet, I have it opened with Access.

  4. #4
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243
    Originally posted by S_Scheible
    If I understand this correctly, CurrentDB is part of ADO. However, I don't have the mdb file opened with ADO yet, I have it opened with Access.
    I opened Access and created a brand new (empty) database.
    CurrentDB.Name gave me also this time path and filename of the currrently opened database.
    Do you mean this isn't working for you?

  5. #5
    Join Date
    Feb 2004
    Posts
    17
    Originally posted by artemide
    I opened Access and created a brand new (empty) database.
    CurrentDB.Name gave me also this time path and filename of the currrently opened database.
    Do you mean this isn't working for you?
    Oops, mea culpa, CurrentDB is exactly what I was looking for (I obviously didn't read the online help right). Thanks a lot!

Posting Permissions

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