Connect to database with user name and password : ADODB.Connection « Access « VBA / Excel / Access / Word






Connect to database with user name and password

 
Sub addUser() 
   Dim myConnection As ADOX.Catalog
   Dim newUser As ADOX.User
   Dim userName As String
   Dim newPassword As String
   
   Set myConnection = New ADOX.Catalog
   myConnection.ActiveConnection = _
        "Provider = Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\r.mdb;" & _
        "Jet OLEDB:System database=C:\r.mdw;" & _
        "User id=john;Password=;"
   Set newUser = New ADOX.User
   newUser.Name = userName
   myConnection.Users.Append newUser
   myConnection.Users(newUser.Name).changePassword "", newPassword
End Sub

 








Related examples in the same category

1.Connection to database
2.Connect to current database
3.Creating a Connection Object
4.open up a schema with a provider to look at all the database objects
5.Connect to databse through URL
6.The Errors Collection