Solved

change access 2003 password using ADO and visual basic

Posted on 2004-10-18
12
320 Views
Last Modified: 2008-02-26
Hello,

I need to change number of databases and set it the same password.
However , I dont know how to set password using ADO, i'm using access 2003
here is my code and it doesnt work:

            Dim myDbase As ADODB.Connection
            Set myDbase = New ADODB.Connection
            myDbase.Mode = adModeShareExclusive
            myDbase.IsolationLevel = adXactIsolated

        myDbase.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" _
                  & dbpath & " ; DefaultDir=" & App.Path & ";" & "PWD=" & Oldpass & ";"
        myDbase.Execute "Alter database password " & Oldpass & " " & newdbpass

            myDbase.Close

how can I set a new password for the access 2003 database?


Thanks,
Eyal
0
Comment
Question by:eylkrn
  • 3
  • 3
  • 3
  • +2
12 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 12340362
I doubt that you can change the password for an Access database via ADO, as the password IS NOT stored in the MDB, but rather is held in the associated MDW (workgroup file), and as such is not accessible from SQL (or via ADO).

AW
0
 

Author Comment

by:eylkrn
ID: 12340750
is there any other way that I change the password?
or is there any program that does what I need?
There most be a way to write a script that change number of databases
0
 
LVL 5

Expert Comment

by:Hammadian2
ID: 12341272
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 5

Assisted Solution

by:Hammadian2
Hammadian2 earned 100 total points
ID: 12341297
0
 
LVL 26

Assisted Solution

by:Alan Warren
Alan Warren earned 400 total points
ID: 12344467
You can change  a JET database password using the CompactDatabase method of a JRO object.
Your source connect string should contain the original old password.
Your destination connect should contain the new password.


reference: Microsoft Jet and Replication Objects 2.6 Library
Function EncryptDb(strSourceDB As String, _
                     strDestDB As String) As String
   Dim jetEngine          As JRO.jetEngine
   Dim strSourceConnect   As String
   Dim strDestConnect     As String

   ' Build connection strings for SourceConnection and
   ' DestConnection arguments.
   strSourceConnect = "Data Source=" & strSourceDB
   strDestConnect = "Data Source=" & strDestDB & ";" & _
                     "Jet OLEDB:Encrypt Database=True" & ";" & _
                     "Jet OLEDB:Database Password = password"

   Set jetEngine = New JRO.jetEngine

   ' Compact and encrypt the database specified by strSourceDB
   ' to the name and path specified by strDestDB.
   
   jetEngine.CompactDatabase strSourceConnect, strDestConnect

   Set jetEngine = Nothing
End Function

Alan
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 12344484
I like the link posted by Hammadian2, seems better than my attempt - LOL

Alan
0
 
LVL 5

Expert Comment

by:Hammadian2
ID: 12347952
Thanks Alan :)
0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 400 total points
ID: 12545264
Hi Venabili,

I like the look of the post by Hammadian2 http:#12341272
Also like mine http:#12344467 

Perhaps a split, unless the author has other plans.

Alan
0
 

Author Comment

by:eylkrn
ID: 12546131
hi Venabili,

dont close it yet..

Eyal
0
 
LVL 20

Expert Comment

by:Venabili
ID: 12583032
eylkrn,

Then please reply to the experts that are trying to help you. We are not mind readers so unless you explain what is wrong with the posted comments, we cannot help more..

Venabili
0
 

Author Comment

by:eylkrn
ID: 12586311
ok, I'm closing this issue because i'm currently working on another project

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question about consuming GB from Comcast 5 61
Input Data Using a unique ID from another sheet in Excel 3 52
Multiple MSSQL instances on same server 4 47
SYbase 4 36
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

808 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