?
Solved

how to detect access db has password or not?

Posted on 2000-05-06
13
Medium Priority
?
170 Views
Last Modified: 2010-05-02
i like to know how can i check access database which i going to open do have password or not using vb?
0
Comment
Question by:cindafuzzy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
13 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2783878
Maybe there is a way but if not then you can make an error handling routine. WHere you would say that password is required.
0
 

Author Comment

by:cindafuzzy
ID: 2784017
Adjusted points from 50 to 55
0
 

Author Comment

by:cindafuzzy
ID: 2784018
i mean the databases is itself is protected with password (ms access can do this)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 6

Expert Comment

by:Marine
ID: 2784085
if your access database is password protected then this is how you can connect to it.
Where it says UID enter your user name and pwd is your password.

Public Sub Con()
On Error GoTo err_con
Dim sCon As String
sCon = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=sample.mdb;" & _
"DefaultDir=" & App.Path & _
";Uid=Val;Pwd=Val;"
cnAcct.Open sCon
Exit Sub
err_con:
    MsgBox Err.Description
    Err.Clear
End Sub
0
 
LVL 6

Expert Comment

by:sharmon
ID: 2784797
Access 2000 or 97?

Shannon
0
 
LVL 6

Expert Comment

by:Marine
ID: 2784818
You haven't mentioned if you were using ADO OR DAO. This method shows you how to do it in ADO with Access 2000
0
 
LVL 6

Accepted Solution

by:
Marine earned 110 total points
ID: 2784829
This is how you can do it with DAO.

Dim db As Database
Dim ws As WorkSpace
Dim rst As Recordset
Set ws = DBEngine.WorkSpaces(0)
Set db = ws.OpenDatabase _
("C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb", _
False, False, "MS Access;PWD=northwind")
Set rst = db.OpenRecordset("Customers", dbOpenDynaset)
       
0
 
LVL 6

Expert Comment

by:Marine
ID: 2784830
Check this link out it has examples of how this done with both Ado and Dao.

http://msdn.microsoft.com/library/techart/daotoadoupdate_topic4.htm

Good Luck.
0
 

Expert Comment

by:ayie
ID: 2785266
i just want to check the database is password protected or not. marine solution is all right, but is there any other way, without try to connect and get error raised coz' of invalid password?
0
 

Author Comment

by:cindafuzzy
ID: 2785278
yup, what ayie said is what i want? do you have any better solution marine?
0
 
LVL 6

Expert Comment

by:Marine
ID: 2789054
Hmm, a C ? You should have not given a grade at all then. What was with this C i think you got good answer for your question. Not fare man.
0
 

Author Comment

by:cindafuzzy
ID: 2789104
yup... your  answer is good enough, but i'm just looking for better answer. i hate to say this but i have already tried out your solution before i post the question. anyway it is better for you to feel thankful since i'm just ingore your answer and let the EE decide for delete pending the question. :). no heart feelling friends... maybe you can answer my next question... see you then....
0
 

Author Comment

by:cindafuzzy
ID: 2789110
anyway, i do have Cs for my answer here... even in my exam.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

752 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