Is there Access command to allow opening from specific location?

T

tschrec

Is there a command or command stream in Access that will allow a database to
be opened only from a specific file location? I would like to prevent people
from opening a database from a network drive and limit opening only from the
hard drive of the PC they are logged on to.
 
J

Jeff Boyce

This might be too much of a kludge ...

It seems like it would be possible to add in some startup code in the
back-end (on "a network drive") that looks for an indication that it's being
started from a proper front-end, and shut it down right away if not.

Then you'd add in some code in the front-end's startup that ensures that the
back-end "sees" the authorization.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
H

Hans Up

tschrec said:
Is there a command or command stream in Access that will allow a database to
be opened only from a specific file location? I would like to prevent people
from opening a database from a network drive and limit opening only from the
hard drive of the PC they are logged on to.

I tried something recently which was fairly simple. I created a file
named not_from_here in the same folder as the database. Then this
function checks whether the file is present and displays a notice and
quits the database if the file is found.

Public Function LocationCheck()
Const strFile As String = "not_from_here"
If Len(Dir(CurrentProject.Path & Chr(92) & strFile)) > 0 Then
MsgBox "Please do not open this database from this location" & _
vbNewLine & "Copy it to your local drive and open the copy."
Application.Quit
End If
End Function

I created an autoexect macro to call the function. You could call it
from a startup form instead. Either way, it can be defeated by a
knowledgeable user who holds down the shift key when starting the
database. You would have to disable the shift bypass to prevent that.
 
T

Tony Toews [MVP]

tschrec said:
Is there a command or command stream in Access that will allow a database to
be opened only from a specific file location? I would like to prevent people
from opening a database from a network drive and limit opening only from the
hard drive of the PC they are logged on to.

In addition to the other responses using the Auto FE Updater which can
create shortcuts on the desk tops via email means that the users won't
need to go mucking about on the file server.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top