Solved

Block run of database if it is in a network folder

Posted on 2006-07-13
8
230 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 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