Solved

Opendatabase method

Posted on 2003-12-02
12
741 Views
Last Modified: 2008-03-17
Im using the Opendatabase method in excel VBA and i'm running into problems.  Here is my connection string

dim dbs as Database
dim rs as recordset

set dbs = opendatabase("c:\sun.mdb", , ,"PWD=tester")

When it reaches the opendatabase line, it gives me an error..."INVALID PASSWORD" when the password is right?  If i disable the password it works?  Any ideas?

0
Comment
Question by:lucas911
  • 6
  • 6
12 Comments
 
LVL 39

Accepted Solution

by:
stevbe earned 45 total points
ID: 9860830
have you tried setting exclusive and read only parameters explicitly?
"tester" needs to be the same case as the real password

Set dbs = opendatabase("c:\sun.mdb", False,False ,"PWD=tester")

Steve
0
 
LVL 13

Author Comment

by:lucas911
ID: 9860915
I can't open this database exclusively because other people will be using it.  The password is all in lower case.

if i put in false, false, as the parameters up there its complaining that its an invalid ODBC connection.

HMMM...
0
 
LVL 39

Expert Comment

by:stevbe
ID: 9861276
and if you dbl click on C:\sun.mdb from windows explorer you enter tester and all is good?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 13

Author Comment

by:lucas911
ID: 9861728
yes sir
0
 
LVL 39

Expert Comment

by:stevbe
ID: 9861823
and you have a reference to the Microsoft DAO 3.6 Object Library?
0
 
LVL 13

Author Comment

by:lucas911
ID: 9861895
Yes sir...DAO is referenced properly
0
 
LVL 39

Expert Comment

by:stevbe
ID: 9861963
can you clear out your data, repair/compact and zip to me? spmazzola AT hotmail.com?

steve
0
 
LVL 13

Author Comment

by:lucas911
ID: 9861979
If i try to use this one:

Set dbs = OpenDatabase("", dbDriverComplete, False, "ODBC;DSN=test;UID=admin;PWD=tester;")

I get this error:

"You cannot use ODBC to import from, export to, or link an external Microsoft Jet or ISAM database table to your database"

And yes i did create an ODBC connection called Test
0
 
LVL 39

Expert Comment

by:stevbe
ID: 9861995
as the message says you cannot connect from one access database to another via DSN.
0
 
LVL 13

Author Comment

by:lucas911
ID: 9862023
I see...but im doing it in Excel 2000 VBA and im just trying to extract the values from that database into excel
0
 
LVL 13

Author Comment

by:lucas911
ID: 9862083
I figure it out.  Man what a crock......

set dbs = Opendatabase("c:\sun.mdb", false, false, ";PWD=tester")

it needs a semicolong in front of the PWD since the UID is default to admin.  Thanks for your help.
0
 
LVL 39

Expert Comment

by:stevbe
ID: 9866027
I guess it is one of thos situations where if you pass the last argument you need to add placeholders for the other, just like you need to for OpenDatabase.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question