Code to Prevent DB from being opened in a specified location?

DKO

Registered User.
Local time
Today, 13:55
Joined
Oct 16, 2007
Messages
47
Like the title says... I have a copy of my front-end db on a shared server so users can copy it to their own computers. The database is still in the development phase, and I'm still making changes to the front-end on a daily basis, then replacing the file on the server so everyone can continue updating their own copies.

The problem is - although I've repeatedly asked my users not to use the copy of the database that is on the shared server....well, let's just say they aren't listening. :mad: Which means I am unable to replace the file with an updated version.

I basically need some code that checks the path of the current db and, if it matches the path of the db on the shared server - display a message, then quit the application.

I've seen something like this on here before, but now I can't find it.

This was my first attempt:

Code:
Dim stLOCATION As String 
 
stLOCATION = "path to db on server"
 
If Application.CurrentProject.Path = stLOCATION Then
    MsgBox "You can not open the Database in this location.  Please copy the file to your own computer."
    DoCmd.QUIT
End If

But, when I attemp to compile, it gives me this error: "Invalid Outside Procedure" - (in reference to the path)

Help?
 
Last edited:
Here's a couple of free FrontEnd Updaters:
http://www.granite.ab.ca/access/autofe.htm
http://www.btabdevelopment.com/main/MyFreeAccessTools/tabid/78/Default.aspx
I would also recommend that you put the BackEnd and you distributable FrontEnd in an invisible folder on the server. Just add a $ to the end of the FolderName and the OS will not display it. BTW, what version of Access are we working with here?

Sorry - I forgot to mention - I'm using '07, but the database is in '02-'03 format. (My company upgraded to '07 in the middle of my build...fun to learn the new ribbon menu while on an "optimistic" deadline...)

Thanks for the tips, guys. I'm going to read them over tomorrow.

I had considered trying to automate the front-end update - I was just afraid of how much time it would take, and I already have a long "give me" list.

I guess it will be worth it - might as well do it now.
 
Hi

you could as mentioned above, hide the folder and add a bit of code to the front end startup to check a later version. This would be a simple text file in the same folder. If the txt content matches or is less than the current front end version, do nothing and open the db otherwise if the txt content is greater than the current version, run the fe updater.

Personally, I haven't looked at the updaters so I don't know what features are available but I use this simple method with mine mainly across Internet but the method is the same.

What mine does is if there is an update, get the front end path and replace the file. This works by opening your initial db which opens the updater.mdb. The updater will close the main db, overwrite it and re-open it which will then close the updater as the versions match.

May sound a bit tricky but quite easy to implement and run.

Personally, I wouldn't allow access to the main source code and only provide a copy.

Hth

Nigel
 

Users who are viewing this thread

Back
Top Bottom