Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent FE from running off network drive? 1

Status
Not open for further replies.

BaudKarma

Programmer
Feb 11, 2005
194
US
I want to place my front end on a network drive and have my users copy it to their local drive before they use it. Is there any way to have the front end check which drive its residing on at runtime? Essentially, I'd like to have the front end display a polite error message and exit unless it is being run from the C: drive.

I try not to let my ignorance prevent me from offering a strong opinion.
 
If you use a Switchboard form, you could add some VBA code to the form's On_Load event:
Code:
Private Sub Form_Load()

If Left$(CurDir$, 1) <> "C" Then
    MsgBox "Please run me from the C: drive", vbCritical, "Database Error Message"
    CloseCurrentDatabase
End If

End Sub
The CurDir$ variable returns the drive and path to the database file, e.g.

C:\MyData\Databases

If the first character of this string is not 'C' then the database file is not on the C: drive. In this case, the code will display the error message of your choice, then close the database file.

Change the code as required, if the PC uses a local 'D' drive etc.

Bob Stubbs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top