How to determine physical location of Access DB in code?

  • I have an Access DB that is a front-end to SQL. We want to distribute the Access DB to end-users by putting it on their desktop. The only way we have to do it right now is by placing it on a common share to which they all (unfortunately) have full access (read/write/control). We want them to copy the DB to their Desktop and run from there, but some of these morons insist on just running it directly from the share. This locks up the DB, prevents us from putting out changes, and generally frustrates me.

    Is there any way in the Access code in a module or macro to determine where the DB that is being opened/executed is located? If so I could check that it's on a local drive and not on the common share. If I can tell where they're trying to run from I can shut them down if they're not running their local copy.

    I've beaten up FSO as far as I can to try and figure this out. I can figure out if a copy of the DB exists on their desktop, but that doesn't tell me where the running copy came from.

    Any ideas?

     

  • Sorry for the late reply. What you are looking for is : Application.CurrentProject.Path

  • Actually that was quicker than I expected!! THanks!!!

     

  • HTH.

  • I usually use a batch file similar to this (in the user's startup or login script) which checks to see if they have the latest version and if not copies the latest to their local machine.  It also copies a "version" file there, which indicates what version they are running:

    if exist c:\access\cfg040608.ver goto end

    md c:\access

    copy p:\access\config.adp c:\access\*.*

    del c:\access\cfg*.ver

    copy p:\access\cfg040608.ver c:\access\*.*

    :end

    exit

    You can even give the file on the share a different name or extension so that or hide it so the users can't easily run it.

    Dick

     

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply