Solved

change access 2003 password using ADO and visual basic

Posted on 2004-10-18
12
335 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
[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
  • 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

696 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