bobdee
Apr 7 2006, 12:26 PM
This is probably a stupid question and I should know the answer, but how do I determine if a folder location is on a user's local PC or not??
On my logon form (which is separate from my application) I want to thwart users who try to logon on to the copy of the front-end which is located on the server. In order to do that, I think I need to determine if the full file path and name for the application that the user has entered onto my logon form is on the user's PC or not.
Unless somebody has a better way.
TIA.
ScottGem
Apr 7 2006, 12:29 PM
Why do the users have access to the version of the FE on the server? That file should be in a development folder kept away from the user.
What I would do though is use UNC Coding to compare the paths. The Code archives should have a utility by r_cubed that will convert a mapped path into UNC.
BrianS
Apr 7 2006, 12:30 PM
What is "the copy of the front-end which is located on the server" used for? If you just use it as a backup of the front end and it is not referenced from the application at all, then just revoke rights to the location from the users. If you need to copy it back down to them, log in as someone who does have rights to the location.
Sometimes these security issues can be solved by simple means, you don't have to code solution if it can be solved in some other (simpler) way
bobdee
Apr 7 2006, 12:44 PM
Actually, I thought the answer would be relatively simple, but I guess that is not the case.
This is for a client, so I have no control over how they set up their folders and if I can put in a simple code fix I would rather do that.
The front end version on the server is used for downloading fresh copies of the front end to user's PCs. The client administrator will retain a master copy in a folder that is inaccessible to all users. My app imports some mega sized files and even though I use a temporary database for"holding tables" and all the subsequently fully-validated data imports are to tables in the back-end file, my front end still bloats considerably. Although I do set a flag in code within the app to compact on close whenever an import process is accomplished, I do not trust compacting. Therefore, on my logon application, user's can download a fresh copy of the front end from the server. I'm probably going to implement code in the logon app that checks the size of the front end on the user's PC. If it exceeds the fresh copy size by a certain percentage, then the logon app will automatically kill the existing front end and download a fresh copy of the front end from the server.
Now that Scott mentions it, I do remember seeing a lot of functions somewhere for UNC paths. Now if I can just find those....
ScottGem
Apr 7 2006, 12:49 PM
You can use the Environ function to get the Computer name of the local PC. If that doesn't match the computer name of the MDB then you have your asnwer.
kenick
Apr 7 2006, 12:54 PM
Can you just check to see if the db is living on their C or D drive?
CODE
Dim strPath As String
Dim strDrive As String
strPath = Application.CurrentProject.Path
strDrive = Left(strPath, 3)
If strDrive = "C:\" Or strDrive = "D:\" Then
' do something
Else
' do something else
End If
bobdee
Apr 7 2006, 01:00 PM
Yeah, that occurred to me. But is it guaranteed that a user's hard drive is always either C or D. I've never tried this and don't want to, but can you change the letter of your hard drive?
kenick
Apr 7 2006, 01:08 PM
Hadn't really thought about that. It's not an issue for us because all of our user's computers are placed with the same image and the user doesn't have administrative rights to where they could change drive letters. My suggestion may not work for you.
ken
glue
Apr 7 2006, 02:00 PM
you could rename the file on the server something like abcdef.ghi
and rename it in the filecopy command in the launcher.
not perfect, but they'd have to work to get it open.
bobdee
Apr 7 2006, 04:37 PM
If that doesn't match the computer name of the MDB.....
I'm not sure what you mean by this. How are you getting the computer name for the MDB?? Are you taking it from the MDB path??
ScottGem
Apr 7 2006, 08:59 PM
No, As I said earlier use the Environ function to get the computer name.
bobdee
Apr 7 2006, 09:16 PM
Scott:
I'm sorry for being dense, but I don't understand the Access help file on the Environ function.
I'd appreciate it if you could help me along on this or point me to where I can get more info on how to use this function. The variables it requires are optional and I don't even know what to set them equal to.
Thank you.
bobdee
Apr 8 2006, 02:30 AM
No need to respond. I have resolved this issue.
ScottGem
Apr 8 2006, 06:52 AM
If you haven't found it, this
article lists the variables the function uses.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.