Front End; Dead End

NauticalGent

Ignore List Poster Boy
Local time
Today, 11:20
Joined
Apr 27, 2015
Messages
6,747
Good Morning again, Access Ninjas!

Attached is the FE updater script I have plagiarized and modified for my purposes.

It works pretty well although I have seen better updaters. I have played with the idea of doing a paradigm shift but I have bigger fish to fry at the moment. That being said, I am in no way married to this code/paradigm and open to any "system" that will accomplish what this script does more efficiently.

The issue is this. The folder we use at my organization is mapped to the "Y" drive. It is a virtual drive and I can use whatever designation I want... That being said, it seems there is an internal "path" between my FE and BE that was established when I originally split the DB.

This has caused a minor problem; The folder that holds the FE and BE is about 3 levels deep from the root level. When I split the DB, I was only mapped to the root level. If the user maps their "Y" past the root level, the application cannot find the tables.

Not a big issue, I just simply disconnect the drive and re-map it and it works fine. However I was looking for something that would account for this and correct it.

I added the code that maps the "Y" drive and it works...until the user exits the application and goes back in. They get a script error telling them that the network drive is already in use (a good programmer would have thought of that!).

I have done some google searches to get the proper syntax to check to see the drive is already in use, disconnect it and then re-connect it and so on and so forth.

But I am not sure if this is the best thing to do and would like some feedback...

As always, thanks in advance!
 

Attachments

added the code that maps the "Y" drive and it works...until the user exits the application and goes back in. They get a script error telling them that the network drive is already in use (a good programmer would have thought of that!).

add to your script to test if the mapped drive "Y:" exists
Code:
Public Function IsMappedDrivePresent(driveLetter)
Dim objNetwork
Dim colDrives
Set objNetwork = Wscript.CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 To colDrives.Count - 1 Step 2
  IsMappedDrivePresent = (colDrives.item(i) = driveLetter)
  If IsMappedDrivePresent Then Exit For
Next
End Function

now before making creating the map drive, test if it already created:
Code:
If IsMappedDrivePresent("Y:") = 0 then 'not yet, then create it
WshNetwork.MapNetworkDrive "Y:", "\\DS\UEUNADFS11\CNE-C6F"
end if
 
re-map the front end tables with UNC paths. DO NOT USE DRIVE LETTERS, for that very reason you gave. No everyone mapped the Y drive, but if you use the unc paths,
\\drive\folder\folder ....
it will never fail.
 
he already has the unc there, "\\DS\UEUNADFS11\CNE-C6F", and its 2 level deep.
 
Arnelgp: You never cease to amaze me, your code works prefect! Even though I wont use it for this instance, you gave me some good tools to use in the future.

RanMan256: Although you didn't give me what I asked for, you gave me what I was really looking for. Now, no matter WHAT drive they map to or HOW deep they map it to, it works.

Thanks to both of you...

...now...

What is meant by "UNC". I was able to figure out what you meant but I want to sound as smart as you two when I have to explain this to someone!
 
UNC : uniform naming convention
It is a path that any computer in your lan understands.

It is recommended to use paths like this "\\Fileserver\Bob"
instead of mapping the Fileserver to a drive letter.

Same reason why domain names exists on the internet. Would be a world of anarchy if we used only IP's.
 

Users who are viewing this thread

Back
Top Bottom