LAN Connection and Linked Tables

BrokenBiker

ManicMechanic
Local time
Today, 04:03
Joined
Mar 22, 2006
Messages
128
My DB checks for connection for linked tables when it opens. The two reasons why the connection may be down is due to either the LAN being disconnected or, due to inconsistent mapping of network drives the folders may be listed differently. For example, someone may have T:\Common\Folder\BE, whereas someone's drive might be mapped directly to 'Folder', in which case the DB FE can't find the "T:\Common" part.

In addition to these inconsistencies, some computers require re-mapping of network drives every time you log on. Fixing these problems are out of my control. However, I have two bits of code that will over come these problems.

One will re-link all linked tables. The VBA opens a browser window for you to select the file to link to. The other will create a *.cmd file that automatically maps the common drive--but it will not over-write an existing network drive.

I'm having trouble using these two functions together. Basically, what I'm looking for is...a loop? I think....It needs to check for continuity, if it doesn't exist, run the *.cmd file. Check for continuity again, and if it's still bad, open a browser window to select the file to link to. If the linked tables are good-to-go, then proceed next.

Currently what I have is this:

Code:
If iLinkIsGood = 0 Then 'Tables are NOT linked
    MsgBox "Your T:Drive may not be mapped properly." & vbCrLf & "" & vbCrLf & "This program will map it for you."
    PubFx_MapT_Drive 'Runs the *.cmd file
    Pause (2)
    PubFx_DeleteCmdFile 'Deletes the *.cmd file
    MsgBox "Your T:Drive is now mapped."
    If iLinkIsGood = 0 Then 'Tables are STILL NOT linked
        fRefreshLinks 'fRefreshlinks opens the browser to select the BE
    Else
    End If
Else
End If

The problem with this set-up is that after the PubFx_MapT_Drive runs, iLinkIsGood still = 0 and it will run fRefreshLinks, even when I know the linked tables are good.

How do I go about the If/Then, Loop, GoTo problem?
 
These might be both dumb and annoying questions but....
My DB checks for connection for linked tables when it opens.
Are you linking to an Access DB?

The two reasons why the connection may be down is due to either the LAN being disconnected or, due to inconsistent mapping of network drives the folders may be listed differently. For example, someone may have T:\Common\Folder\BE, whereas someone's drive might be mapped directly to 'Folder', in which case the DB FE can't find the "T:\Common" part.
I do not understand why you have to do this - I thought that the UNC (Universal Naming Convention) path is the solution to the problem of different mappings? The UNC path cannot change - the mapping can and looks like it can be anything.
 
UNC is the way to go for most programmers but the UNC will change if the server is changed. Rare but it can happen when old servers are retired, etc.
 
The UNC path cannot change - the mapping can and looks like it can be anything.
Oppps sorry if this is misleading. The UNC can change but not from computer to computer at boot time.

To mapp a drive so that it gets your letters it must be mapped to this UNC. You can map a UNC to any drive letter and depending on the admistrator setting of the computer you can change the drive letter.

Of course the administrator of a server could change the UNC path, but that is really annoying.
 
Problem solved. Just re-accomplish the fIsFileDIR to get the new value.

Yes, this is linking to an Access DB. I'm not familiar w/the UNC. However, maybe I can clarify a little why this is necessary.

First, for several computers on our network, the shared drive mapping is lost, and needs to be re-connected (Map Network Drive) when they log on. Hence, the reason for the PubFx_MapTDrive.

Since our network drives/shared drives are mapped manually, they are not all mapped the same. So, someone's T-Drive may by mapped to the root directory, while other's may have there's mapped to an entrenched folder. For example, my T-Drive is mapped to "SharedFolder", while others are mapped to "SharedFolder\DifferentSharedFolder", so their originating points for the "T-Drive" are different. This causes a problem with the linked tables. Hence, the use of the 'fRefreshLinks' function.

In the past, I linked tables through the network, however Access07 doesn't allow that. But as I was typing this out, I found that I can just past the network name in the browser window from the Linked Table Manager and it re-links the tables as "\\Network\folder\subfolder", so that should help alleviate the problem a bit.

Code:
If iLinkIsGood = 0 Then 'Tables are NOT linked
    MsgBox "Your T:Drive is not mapped properly." & vbCrLf & "" & vbCrLf & "This program will map it for you."
    PubFx_MapT_Drive
    Pause (2)
    PubFx_DeleteCmdFile
    MsgBox "Your T:Drive is now mapped."
End If
    
If fIsFileDIR(fGetLinkPath("tbl_Employees")) = 0 Then
    fRefreshLinks
End If
 

Users who are viewing this thread

Back
Top Bottom