[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to detect access db has password or not?

Posted on 2000-05-06
13
Medium Priority
?
173 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
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
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!

 
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

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.

Question has a verified solution.

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

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

830 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