Okay, I know I've seen how that is done before but I can't find it. I did do this test and it worked fine for me (as an example).
Code:Dim strSQL As String Dim db As DAO.Database Dim strCurDb As String strCurDb = CurrentProject.FullName Set db = OpenDatabase("C:\Temp\PWDProtectedDb.mdb", False, False, "MS Access; pwd=1234") strSQL = "SELECT Employees2.LastName, Employees2.FirstName INTO NewTable " & _ "FROM " & strCurDb & ".Employees2;" db.Execute strSQL, dbFailOnError db.Close Set db = Nothing
Thanks Bob; I'm trying to follow what you're doing.
I see the OpenDatabase is supplying the password to the receiving database. But I'm not getting where the second database is getting it's password supplied?
Sorry, I've been struggling with this on and off for days.
I did get jal's code to work but when I tried to adapt it to my more complex sql string, it didn't work.