Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

change access 2003 password using ADO and visual basic

Posted on 2004-10-18
12
Medium Priority
?
342 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Assisted Solution

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

Assisted Solution

by:Alan Warren
Alan Warren earned 1200 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 1200 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

597 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