Hi,
I am trying to connect to another db using the following code:
the code works fine if the db is in my computer
but, usually the dbPath is a path for an Access db on a server, which requires a username and a password
sure this code will not work in such case, cos it needs the username and the password, so is there a way to slip (as parameters) the username and password in the above code? i am not that much into vba coding
any help will be appreciated
I am trying to connect to another db using the following code:
Code:
Dim db As Database
Dim con As Container
Dim doc As Document
Dim newLink As TableDef
Set db = CurrentDb()
Set newLink = db.CreateTableDef("WebResume")
newLink.Connect = ";DATABASE=" & dbPath & dbName
newLink.SourceTableName = "WebResume"
db.TableDefs.Append newLink
Set con = db.Containers("Tables")
Set doc = con.Documents("WebResume")
doc.Permissions = dbSecRetrieveData
doc.UserName = "Admin"
doc.Permissions = dbSecRetrieveData
doc.UserName = "Users"
doc.Permissions = dbSecRetrieveData
Debug.Print "New AllPermissions: " & doc.AllPermissions
the code works fine if the db is in my computer
but, usually the dbPath is a path for an Access db on a server, which requires a username and a password
sure this code will not work in such case, cos it needs the username and the password, so is there a way to slip (as parameters) the username and password in the above code? i am not that much into vba coding
any help will be appreciated