Ensure User Launches from Local Front End

  • Follow


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 


0
Reply JohnC 4/7/2007 8:28:14 PM

On Apr 7, 4:28 pm, "JohnC" <anonym...@news.groups.com> wrote:
> 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

0
Reply Gord 4/7/2007 9:33:04 PM

"JohnC" <anonymous@news.groups.com> wrote in message 
news:a164$4617fed1$40971c7d$22304@EVERESTKC.NET...
> 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?



0
Reply Jeff 4/7/2007 9:36:07 PM

JohnC wrote:

>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

-- 
Marsh
MVP [MS Access]
0
Reply Marshall 4/7/2007 11:47:39 PM

On Apr 7, 6:47 pm, Marshall Barton <marshbar...@wowway.com> wrote:
> JohnC wrote:
> >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
>
> --
> Marsh
> MVP [MS Access]

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.


0
Reply Dennis 4/8/2007 1:32:36 PM

"Dennis" <dennismahoney@gmail.com> wrote in message 
news:1176039156.638267.143770@o5g2000hsb.googlegroups.com...
> On Apr 7, 6:47 pm, Marshall Barton <marshbar...@wowway.com> wrote:
>> JohnC wrote:
>> >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
>>
>> --
>> Marsh
>> MVP [MS Access]
>
> 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 


0
Reply JohnC 4/8/2007 4:40:22 PM

JohnC wrote:
> 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.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com 


0
Reply Rick 4/8/2007 4:55:04 PM

On Apr 7, 6:47 pm, Marshall Barton <marshbar...@wowway.com> wrote:
> JohnC wrote:
> >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
>
> --
> Marsh
> MVP [MS Access]

Marsh,

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

0
Reply Robert 4/9/2007 8:08:19 PM

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



"JohnC" wrote:

> 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 
> 
> 
> 
0
Reply Utf 4/9/2007 10:10:01 PM

Robert_L_Ross <RobertLRoss@discussions.microsoft.com> wrote:

>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
0
Reply Tony 4/10/2007 3:54:35 AM

"Marshall Barton" <marshbarton@wowway.com> wrote in message 
news:lv9g13lhe3rv7ckh1scj1r4nn2ftv1a47l@4ax.com...
> JohnC wrote:
>
>>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
>
> -- 
> Marsh
> MVP [MS Access]

Perfect!  Very elegant.  Thank you Marshall.

John 


0
Reply JohnC 4/11/2007 2:15:20 AM

10 Replies
180 Views

(page loaded in 0.111 seconds)

Similiar Articles:













7/5/2012 11:08:42 PM


Reply: