Opendatabase method

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?

LVL 13
LucasMS Dynamics DeveloperAsked:
Who is Participating?
 
stevbeConnect With a Mentor Commented:
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
 
LucasMS Dynamics DeveloperAuthor Commented:
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
 
stevbeCommented:
and if you dbl click on C:\sun.mdb from windows explorer you enter tester and all is good?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LucasMS Dynamics DeveloperAuthor Commented:
yes sir
0
 
stevbeCommented:
and you have a reference to the Microsoft DAO 3.6 Object Library?
0
 
LucasMS Dynamics DeveloperAuthor Commented:
Yes sir...DAO is referenced properly
0
 
stevbeCommented:
can you clear out your data, repair/compact and zip to me? spmazzola AT hotmail.com?

steve
0
 
LucasMS Dynamics DeveloperAuthor Commented:
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
 
stevbeCommented:
as the message says you cannot connect from one access database to another via DSN.
0
 
LucasMS Dynamics DeveloperAuthor Commented:
I see...but im doing it in Excel 2000 VBA and im just trying to extract the values from that database into excel
0
 
LucasMS Dynamics DeveloperAuthor Commented:
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
 
stevbeCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.