OpenDatabase - Not a Valid Password

Tsango

Registered User.
Local time
Today, 15:42
Joined
Mar 31, 2006
Messages
64
This is driving me mad - can anyone get there head around this

I want to programatically add/delete fields ect from the front end. However I keep getting "Password Not Valid" at the set db line when I know it's correct

Dim wrkJet As Workspace
Dim db As Database
Dim cnn As ADODB.Connection
Dim SQL As String

' Create Microsoft Jet Workspace object.
Set wrkJet = CreateWorkspace("NewWorkSpace", "admin", "", dbUseJet)
Set db = wrkJet.OpenDatabase("C:\Data\BackEnd_be", True, False, "PWD=mypass")

SQL = "ALTER TABLE Staff ADD COLUMN Test TEXT (10);"

db.Execute SQL
 
I figured out the problem if anyone is interested.

The Set db line should read

Set db = wrkJet.OpenDatabase(<database path>, True, False, "MS Access;PWD=<password>")
 
I used your technique today. Thanks for posting your solution.:)
 

Users who are viewing this thread

Back
Top Bottom