Discussion Locked

self-locating database

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can an Access database find out where it resides, as distinct from where it is running? I have tried CurrentDB().Properties("Location"), but I get a runtime error message as the property "Location" seems not be known. The purpose of finding location is to direct the opening of a Word file supposed to be in the same location as the database. The use should notice nothing except the Word file opening in front of him: he should not himself need to know the location.

3 replies

by techrep

Dim CurDb As Database, CurrentDatabase as String
Set CurDb = DBEngine(0)(0)
CurrentDatabase = CurDb.Name

'CurrentDatabase will contain the full path and database filename.

This discussion is closed to new replies.