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:
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?
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?