Solved

how to detect access db has password or not?

Posted on 2000-05-06
13
165 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 55 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
VBA saving file message display 5 72
Sending a email via excel using vba 6 97
Run code from text file in vb 1 71
MS SQL store procedure to calculate and return result 6 62
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

809 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