Solved

Block run of database if it is in a network folder

Posted on 2006-07-13
8
231 Views
Last Modified: 2006-11-18
I have a database.  (split into front and backend)
Users are instructed to run this from their C: hard drive OR from a flash drive, then back up to their folder on the network (always mapped as Y:)

I would like to BLOCK the run, if it is over the network.  It slows down for the user, and for everyone else on the network.

What code can I insert to check the drive on the path.  (so.. I don't want it to run off the Y: drive.. I DO want it to run off the C: drive.. OR.. off the users E:, F: or whatever other path their flash drive connects as.
0
Comment
Question by:pfleischer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 35

Assisted Solution

by:Raynard7
Raynard7 earned 400 total points
ID: 17104544
if currentproject.path like "Y:\*" then
    'Do Not Run Backup
else
    'Run Backup
end if
0
 
LVL 26

Expert Comment

by:dannywareham
ID: 17104674
The volume of users in a networked system will have some impact - but the main impact will be the network speed itself.

You can speed it up by optimising your query speeds and using some connection tricks.

Using queries, you could have a kind of "log in" table.

Same as your back up facility (but other way around).
When a user opens the database, simply INSERT a record to the table.

Then run another query to count how many people are in the table (as they are logged in).
If too many, kick the user out.

When a user logs out, you run a DELETE query to minus off one user...

Idea...?
0
 
LVL 1

Author Comment

by:pfleischer
ID: 17104900
Danny... I'm not going to try to solve our network issues.. that's someone elses job :-)   but I REALLY don't want to have users slow down (really, its painful) and abandon this application.  we are still in an 'adoption' mode.. so I want success!

Raynard, that looks really simple.
where do I actually put that code?
I don't want to block the BACKUP.. I want to block the run of the whole application
so.. can I put this in the startup for the Menu form?

then maybe redirect to a different form, that gives info about why they are not getting the menu..

Paula
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 65

Expert Comment

by:rockiroads
ID: 17106567
Paula, is it fair to say you do not want it run if its on any network drive? You may want to consider not hardcoding paths just in case you move location or user has mapped to a different letter.


We can go for one of two choices

1. Check path is a network drive
2. Check path is a local drive (users may have a C and a D drive)

Well either way, its just one API call

add the following in a new module in Access




Private Declare Function PathIsNetworkPath Lib "shlwapi" Alias "PathIsNetworkPathA" (ByVal pszPath As String) As Long
 
Public Function IsPathNetPath(ByVal sPath As String) As Boolean
   IsPathNetPath = PathIsNetworkPath(sPath) = 1
End Function





Now what u do is add a check in either a startup form or a macro (startup Macro is called AutoExec)

Lets say a form, if your application has one form that is always called on startup, add the following code to Form_Open

private sub Form_Open(Cancel as Integer)
    If IsPathNetPath(CurrentProject.Path) = True then
        Cancel = True
        msgbox "Sorry, but running this application from the Network is not allowed. Please contact Paula for more information.",vbInformation,"Access Denied"
        Application.Quit
end sub
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17107206
One thing, if user runs from flash drive then this may return FALSE
I dont have one - too poor :(
so I cant test to see what value it returns
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 100 total points
ID: 17107222
if u go the hardcoded route and not run on Y, and u want it in vba then small tweak to Raynard7's code

if currentproject.path like "Y:\*" then

should be

if left$(currentproject.path,3) = "Y:\" then
    msgbox "We on the Y Drive!!!"
end if


Now, what if the user ran from another network drive, are you going to allow that?
0
 
LVL 39

Expert Comment

by:stevbe
ID: 17107566
To go for overkill ... I have a settings table I use to validate all sorts of things at startup and I would place that table on the netwrok so if I ever needed to change the 'Y' I can do it as a configuration and not redistribute the whole app.

Steve
0
 
LVL 1

Author Comment

by:pfleischer
ID: 17115218
THANKS everyone.  THis all works perfectly now.
I put it in code when the Menu loads - so users get a msgbox, instead of the menu if it is on the wrong drive.

Our users are not savvy enough to put this on other network drives ;-)

The history is:  
This was INTENDED to run off the network for backup purposes, but we discovered 2 weeks into implementation (and of course AFTER training and users had set up their files) that our network couldn't handle 100 teachers all getting on after school to enter their data and run reports.

SO.. I sent out an email, instructing everyone to copy the whole folder to their C drives, and BACK UP to their Y drives.  The tech-savvy ones were able to follow the directions.   Others, just ignored the email as "too techy" and left it on their Y drive.  About March or April, as their files got larger, their processing time slowed horribly.  When I got those frustrated "why is this so slow" emails, I just forwarded them the October directions for moving their files.  Some did... some didn't.  :-P  

BUT.. they slow down other processes, and I really don't want this application to bog down the whole system next school year.  So this is PERFECT!!  again thanks and thanks and thanks Paula
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question