ms access - VBA MapNetworkDrive to server with windows credentials -


I am using Windows 7 and Access 2010 I'm trying to connect to my server to view files Am My problem is that I do not want to have a username or password in the code. I want to do windows to indicate if authentication is required (by my trial, once to prove that you do not have to redo it for a while), strUser and strPassword are optional and Existing users uses credentials, but this does not seem to work for a server.

dim objFSO object as object dim objNetwork in as dim objFolder
 As Object Dim strShareLetter As String Dim strURL string, string StrUser string strShareLetter as strPassword = " set L "objFSO = CreateObject (" Scripting.FileSystemObject ") strURL =" \\ company @ SSL \ DavWWWRoot \ companydav \ nodes \ 12345678 \ "objNetwork set = Bnaaaobjekt (" WScript.Network ") objNetwork.MapNetworkDrive strShareLetter, strURL, false, Strugr, Strosward set objFolder = objFSO.GetFolder (strURL) by MsgBox objFolder.Files.Count MsgBox objFolder.SubFolders.Count T objFolder = Nothing Set objFSO = nothing objNetwork.RemoveNetworkDrive (strShareLetter) set objNetwork = Nothing  

If I type the code my user / password for all the work . But I need other users to be able to use it and I do not want my credentials being used everywhere when I should show such quick or something credentials of windows I for security reasons I user password by vba Do not want to prompt.

Any thoughts? I searched Google for the solution, but I can not find anybody thanks

It seems that you first It is only recognized that you need some type of user form in your project to collect user credentials.

Here's how I will do it. I insert the user-form from the VBA editor. From there, I take it in some text boxes and labels, one box is labeled as "User ID" and the second is called "password". To mask the password password for the password text box, I want to include "*" in the PasswordChar property. I also want to put a button on there to say that for the effect or "log in" or something else "Send"

Once you have done that, you need a couple of qualities Will be:.

  private pUserId string private pPassword As String (value As String Public Property Let User-ID) pUserId = Value End (as value property as public property String UserId = pUserId termination property public property Let password user-id () go string) pPassword = value termination property as public property password () The X = pPassword end property  

Then you click the button event you hide the box and form the property will want to load information from text to your login use.

  Private Sub CommandButton1_Click () UserId = TextBox1.text password = TextBox2.text Me.hide End Sub  

Then dim you have to do And display the user form for the user.

  ... set objNetwork = CreateObject ( "WScript.Network") Dim LogInFor meters UserForml set LogInForm = new UserForm1 LogInForm.Show vbModal objNetwork.MapNetworkDrive strShareLetter, strURL, false, LogInForm.UserId, LogInForm.Password ... as 

and that's it enough. You may need to create a user form in VBA or learn to brush up on that.


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -