Solved

Opendatabase method

Posted on 2003-12-02
12
748 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Suggested Solutions

Title # Comments Views Activity
Single Step Macro 4 39
Access database located in "cloud" storage 12 83
Object Variable or Block Variable Not Set - Adobe Acrobat 31 63
Problem with vba code 4 36
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

792 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