|
-
Connecting to Access database with database password
I have been trying to connect to an Access database that has a database password,
according to instructions I have been able to find on the internet and in
"Access 97 Developer's Handbook". I have not been successful.
The DAO code suggested is:
dim work as Workspace
dim db as Database
dim rs as Recordset
dim strSQL as String
Set wrk = DBEngine.Workspaces(0)
Set db = wrk.OpenDatabase("c:\path\database.mdb:,False,False,_
";PWD=password")
strSQL = "select......from table..."
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
When I open the application and point it at my desired database/recordset
I get an error message: Run-time error '13': Type Mismatch for the set rs
= db.....statement.
Any suggestions? What am I doing wrong? Alternatively (preferrably?) is there
ADO coding I could use to open and utilize the password protected Access
database?
I have tried this with a DSN-less connection:
Dim m_cnn As ADODB.Connection
Dim m_rst as ADODB.Recordset
Set m_cnn = New ADODB.Connection
m_cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\path\_ database.mdb",
, "password" [I have also tried listing Jet 3.51]
Set m_rst = New ADODB.Recordset
m_rst.Open "SELECT * FROM AnyTable", m_cnn, _
adOpenKeyset, adLockOptimistic
But I think this is for opening an Access database with Workgroup-based security,
rather than opening past a simple database password, and I get the following
error message with the connection .Open command:
Run-time error '-2147217843(80040e4d)': Cannot start your application. The
workgroup information file is missing or opened exclusively by another user.
I have tried the above code as written, with "admin", and with "" for the
User ID as I don't think I have any User ID set up, and got the same error
message.
Any other suggestions?
Thanks for any help. marxbro
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks