Mapping network drive

Gregof1976

Registered User.
Local time
Yesterday, 23:18
Joined
Mar 28, 2011
Messages
44
I have a smal Access application that works in the network. When some users try run application received error that network drive is disconect. Therfore I would like put for application some VBA code that establish network connection to specific drive... something like this
Code:
Set WshNetwork = CreateObject("WScript.Network")
On Error Resume Next
WshNetwork.RemoveNetworkDrive "X:", True
On Error GoTo 0
WshNetwork.MapNetworkDrive "X:", "[URL="file://\\p00002apl\vba"]\\p00002apl\vba[/URL]" 'HardDrive"
Set WshNetwork = Nothing

Where I should put this code to run "before" open application? (I using this code in excel in 'Workbook_Open', but for access I have no idea where should be put to work).

Thank for the feedback
 
Hi

You can create a module and put the code in ther as a function, then create an AutoExec macro to call the function. AutoExecs are called on opening of database.

Hth

Nidge
 

Users who are viewing this thread

Back
Top Bottom