Ensure User Launches from Local Front End

J

JohnC

RE: Access 2003

My application has been split and the front end runs on client PCs with the
back end on a LAN file server. Also I have an updater routine that copies
an updated client from the LAN file server to the client PCs when needed. I
keep the client front end on the LAN server for distribution purposes. The
problem is that occasionally, user's get confused and go to the LAN file
server and run the application from the front end file that is on the LAN
server. I want them to use their client front end on their PC. I plan to
add code to check for this (see below). Is there a better way to do this?

John


Sub ClientLocal()
On Error GoTo Err_ClientLocal

' Quits if the user launches the application from a LAN file.
' Should launch from a client on users PC.

Dim strDrive As String
Dim strMessage As String
Dim strTitle As String

strDrive = Left(CurrentDb.name, 1)

strTitle = "Login Error"
strMessage = "It appears that you have launched the application from a
LAN file location."
strMessage = strMessage & "Please consult your system administrator.
Application terminating."

If strDrive > "D" Then
MsgBox strMessage, vbCritical, strTitle
Quit
End If

Exit_ClientLocal:
Exit Sub

Err_ClientLocal:
MsgBox Err.Description
Resume Exit_ClientLocal

End Sub
 
G

Gord

RE: Access 2003

My application has been split and the front end runs on client PCs with the
back end on a LAN file server. Also I have an updater routine that copies
an updated client from the LAN file server to the client PCs when needed. I
keep the client front end on the LAN server for distribution purposes. The
problem is that occasionally, user's get confused and go to the LAN file
server and run the application from the front end file that is on the LAN
server. I want them to use their client front end on their PC. I plan to
add code to check for this (see below). Is there a better way to do this?

John

Sub ClientLocal()
On Error GoTo Err_ClientLocal

' Quits if the user launches the application from a LAN file.
' Should launch from a client on users PC.

Dim strDrive As String
Dim strMessage As String
Dim strTitle As String

strDrive = Left(CurrentDb.name, 1)

strTitle = "Login Error"
strMessage = "It appears that you have launched the application from a
LAN file location."
strMessage = strMessage & "Please consult your system administrator.
Application terminating."

If strDrive > "D" Then
MsgBox strMessage, vbCritical, strTitle
Quit
End If

Exit_ClientLocal:
Exit Sub

Err_ClientLocal:
MsgBox Err.Description
Resume Exit_ClientLocal

End Sub

Hi, John.

If the environment in which you operate is sufficiently homogeneous
that you can be sure that any drive letter above D: will be a mapped
drive to a network share then your approach is fine.

However, if you are in an environment where some workstations may have
local drives above D: because of multiple hard drives, multiple
partitions, SUBST'ed drives etc., then simply checking the drive
letter may not be sufficient. If that is true and if you are able to
use the Windows Script Host Object Model (wshom.ocx) you might try
using the EnumNetworkDrives method of the WshNetwork object, as in:

Sub ShowNetworkDrives()
Dim wshNet As New WshNetwork
Dim NetworkDrives As WshCollection
Dim thing As Variant

Set NetworkDrives = wshNet.EnumNetworkDrives

If NetworkDrives.Count = 0 Then
MsgBox "There are no mapped network drives"
Else
For Each thing In NetworkDrives
MsgBox thing & " is a network drive"
Next
End If

Set NetworkDrives = Nothing
Set wshNet = Nothing
End Sub
 
J

Jeff Smith

JohnC said:
RE: Access 2003

My application has been split and the front end runs on client PCs with
the back end on a LAN file server. Also I have an updater routine that
copies an updated client from the LAN file server to the client PCs when
needed. I keep the client front end on the LAN server for distribution
purposes. The problem is that occasionally, user's get confused and go to
the LAN file server and run the application from the front end file that
is on the LAN server. I want them to use their client front end on their
PC. I plan to add code to check for this (see below). Is there a
better way to do this?

John


Sub ClientLocal()
On Error GoTo Err_ClientLocal

' Quits if the user launches the application from a LAN file.
' Should launch from a client on users PC.

Dim strDrive As String
Dim strMessage As String
Dim strTitle As String

strDrive = Left(CurrentDb.name, 1)

strTitle = "Login Error"
strMessage = "It appears that you have launched the application from a
LAN file location."
strMessage = strMessage & "Please consult your system administrator.
Application terminating."

If strDrive > "D" Then
MsgBox strMessage, vbCritical, strTitle
Quit
End If

Exit_ClientLocal:
Exit Sub

Err_ClientLocal:
MsgBox Err.Description
Resume Exit_ClientLocal

End Sub

Why don't you place a shortcut on their desktop which is linked to the one
on their PC?
 
M

Marshall Barton

JohnC said:
RE: Access 2003

My application has been split and the front end runs on client PCs with the
back end on a LAN file server. Also I have an updater routine that copies
an updated client from the LAN file server to the client PCs when needed. I
keep the client front end on the LAN server for distribution purposes. The
problem is that occasionally, user's get confused and go to the LAN file
server and run the application from the front end file that is on the LAN
server. I want them to use their client front end on their PC. I plan to
add code to check for this (see below). Is there a better way to do this?


If you place the master FE copy in the same folder as the BE
database, then you can check if the path to the BE and FE
folders are the same. (air code)

Dim strBEpath As String
With CurrentDb()
strBEpath = Mid(db.TableDefs!anylinkedtable.Connect, 11)
strBEpath = Left(strBEpath, InStrRev(strBEpath, "\") - 1)
If strBEpath = CurrentProject.Path Then
MsgBox . . .
Application.Quit acQuitSaveNone
End If
End With
 
D

Dennis

If you place the master FE copy in the same folder as the BE
database, then you can check if the path to the BE and FE
folders are the same. (air code)

Dim strBEpath As String
With CurrentDb()
strBEpath = Mid(db.TableDefs!anylinkedtable.Connect, 11)
strBEpath = Left(strBEpath, InStrRev(strBEpath, "\") - 1)
If strBEpath = CurrentProject.Path Then
MsgBox . . .
Application.Quit acQuitSaveNone
End If
End With

I think you can avoid having users use the network copy by making the
folder where it resides "read only". When we began using our
application on the network this was a glitch for us.
 
J

JohnC

Dennis said:
I think you can avoid having users use the network copy by making the
folder where it resides "read only". When we began using our
application on the network this was a glitch for us.

Thanks for all the replies and good suggestions. If I make the folder "read
only" I believe they can still open the FE MDB but only in "read only" as
there will be no .ldb file. Correct?

Can I make the master FE "hidden"? Not by using file attributes because
that is too easy to view hidden files. We are using Windows Server. Does
Windows Server have some way to hide files? I think Novell uses a dollar
sign.

John
 
R

Rick Brandt

JohnC said:
Thanks for all the replies and good suggestions. If I make the
folder "read only" I believe they can still open the FE MDB but only
in "read only" as there will be no .ldb file. Correct?

Can I make the master FE "hidden"? Not by using file attributes
because that is too easy to view hidden files. We are using Windows
Server. Does Windows Server have some way to hide files? I think
Novell uses a dollar sign.

You can make the share hidden (dollar sign).

You can make the file have acompletely different name and have the script that
copies it rename it at the same time.

You can check the folder being run from in your startup code.
 
R

Robert Jacobs

If you place the master FE copy in the same folder as the BE
database, then you can check if the path to the BE and FE
folders are the same. (air code)

Dim strBEpath As String
With CurrentDb()
strBEpath = Mid(db.TableDefs!anylinkedtable.Connect, 11)
strBEpath = Left(strBEpath, InStrRev(strBEpath, "\") - 1)
If strBEpath = CurrentProject.Path Then
MsgBox . . .
Application.Quit acQuitSaveNone
End If
End With

Marsh,

Can you help me with my question? Posted within this forum
(comp.databases.ms-access), Subject is Sync subform. Thanks!
 
R

Robert_L_Ross

John,

My company has approved a program called StartMDB.exe for us to use for
client/server style databases.

It uses an .ini file to house key information:
back end location
front end location (server and local)
database status (open or closed)
install-to directory
workgroup
etc.

We've been using it to install/maintain user front end files for years now
and it works like a charm. The user doesn't need to know where the back end
is, or even the front-end master file is...it all ends up as black magic to
them. And if you use on-the-fly table linking, they don't even need an ODBC
profile set up on their local machine.

http://www.granite.ab.ca/access/autofe.htm
 
T

Tony Toews [MVP]

Robert_L_Ross said:
My company has approved a program called StartMDB.exe for us to use for
client/server style databases.

Thank you. Glad to hear it works for you.

And it's free.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
J

JohnC

Marshall Barton said:
If you place the master FE copy in the same folder as the BE
database, then you can check if the path to the BE and FE
folders are the same. (air code)

Dim strBEpath As String
With CurrentDb()
strBEpath = Mid(db.TableDefs!anylinkedtable.Connect, 11)
strBEpath = Left(strBEpath, InStrRev(strBEpath, "\") - 1)
If strBEpath = CurrentProject.Path Then
MsgBox . . .
Application.Quit acQuitSaveNone
End If
End With

Perfect! Very elegant. Thank you Marshall.

John
 

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