Solved

how to detect access db has password or not?

Posted on 2000-05-06
13
162 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
 
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

743 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

13 Experts available now in Live!

Get 1:1 Help Now