Mapping Network Drive

AndyV

Registered User.
Local time
Today, 16:34
Joined
Apr 24, 2008
Messages
32
I have an access appication that will be used by three or our users. One of the functions of the app will be to copy files off a share on our lotus notes / windows server, import them and then delete the files from the server. Our network chaps have created a logon that has read / delete permissions to the share, as the server is hidden in the normal windows explorer view to most users.

Using VBA, is there any way I can map a network drive to a PC using a specific logon so that I can access the files, then disconnect the previously mapped drive.
 
Check out the WNetAddConnection2 API.
 
Any idea how I might use it?
 
I saw an article http://support.microsoft.com/kb/210219 but I am trying now to find out how to use a login other than the current user

Code:
Public Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (ByRef lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long

The reason I pointed you to use WNetAddConnection2 is that you pass the username and password as parameters there by allowing you to connect to a drive as a user other than the current user.
 
Many thanks, all working. Next I have to use the FileSystemObject to loop through each folder, and in each folder loop through each file.
 

Users who are viewing this thread

Back
Top Bottom