By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

How do I change an MS Access Database PAssword from VB Code

P: n/a
I am trying to change an existing database password from VB 6.
The database is an MS Access 2000 database if this helps
How do I do this?
Any help is appreciated.
Thanks

Ali

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"alijsyed" <al******@hotmail.com> wrote
I am trying to change an existing
database password from VB 6.
The database is an MS Access 2000
database if this helps


I'm sure this is possible if you are very knowledgeable of the internals,
but AFAIK there is no documented method... if there were, what would prevent
anyone who wanted to grab your data from doing the same?

Larry Linson
Microsoft Access MVP
Nov 13 '05 #2

P: n/a
"Larry Linson" <bo*****@localhost.not> wrote in
news:SDpqe.3372$2K4.946@trnddc08:
"alijsyed" <al******@hotmail.com> wrote
I am trying to change an existing
database password from VB 6.
The database is an MS Access 2000
database if this helps


I'm sure this is possible if you are very knowledgeable of the
internals, but AFAIK there is no documented method... if there were,
what would prevent anyone who wanted to grab your data from doing the
same?

Larry Linson
Microsoft Access MVP


I thought you could do some of this with ADOX?

At the very least, assuming you know the existing Database password (as
opposed to a given user password...), you should be able to do it through
Automation, even in VB...

(reference "Microsoft Access X.0 Object Library" in the VB app), then...

Dim acc as Access.Application

set acc = New Access.Application
acc.OpenCurrentDatabase FullFileNameTo.MDB[, ExclusiveFlag]
acc.CurrentDb.NewPassword oldpwd, newpwd

acc.CloseCurrentDatabase
set acc=nothing

If you actually have a secured database, then you have to either do it
through DAO or with the ADOX library, after logging into the database as
a user in the Admins group or as the database owner.
Nov 13 '05 #3

P: n/a
alijsyed wrote:
I am trying to change an existing database password from VB 6.
The database is an MS Access 2000 database if this helps


It depends on which object model you are using in VB - DAO or ADO.

The DAO method should be something like this:

Dim dbLink As DAO.Database
Set dbLink = DBEngine(0).OpenDatabase(m_sBackEndDatabaseFile, True, _
False, ";PWD=" & sOldPass)
dbLink.NewPassword sOldPass, sNewPass
dbLink.Close
Set dbLink = Nothing

where sOldPass is the old password and sNewPass is the new one. I would think you need
exclusive use of the database to do this so there may be additional code required.
Search on the undocumented PrivDBEngine call to see one way of determining this.

All the mantras apply of course - the Database password really supplies little security
other than keeping honest users out...

--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.