OK i got it to work but I had to use ADODB like this:
VB Code:
Dim objConn As ADODB.Connection = New ADODB.Connection
With objConn
.Mode = 12
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open("Data Source=G:\Users.mdb;Jet OLEDB:Database Password=a")
.Execute("ALTER DATABASE PASSWORD b a;")
End With
But I'd rather use OLEDB so I don't have to add another dll. I use this code
VB Code:
Dim conDatabase As OleDb.OleDbConnection = New OleDb.OleDbConnection
Dim cmdCommand As OleDb.OleDbCommand
conDatabase.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Users.mdb;Jet OLEDB:Database Password=b;Jet OLEDB:Database Locking Mode=12"
conDatabase.Open()
cmdCommand = conDatabase.CreateCommand
cmdCommand.CommandText = "ALTER DATABASE PASSWORD a b;"
cmdCommand.ExecuteScalar()
But I get an error on execute scalar:
"Cannot change password on a shared open database."
Any help would be great to get it working on OLEDB otherwise Ill just have to add the ADO DLL.