Solved

Opendatabase method

Posted on 2003-12-02
12
718 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now