PC Review


Reply
Thread Tools Rate Thread

Access and VB

 
 
Chris Huddle
Guest
Posts: n/a
 
      23rd Aug 2004
Does anyone know how to programatically set a password for an Access
Database, preferably in ADO? Thanks! - Chris


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      23rd Aug 2004
Chris,

Maybe you find it here

Access Automate
http://support.microsoft.com/default...EN-US;317113#7

I hope this helps a little bit?

Cor


 
Reply With Quote
 
=?Utf-8?B?R2VyYXJkIE8nRG9ubmVsbA==?=
Guest
Posts: n/a
 
      24th Aug 2004
Hi Chris,

This code will set a password to a previously unprotected Access database:

Dim cnData As ADODB.Connection
Set cnData = New ADODB.Connection
With cnData
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=c:\mydatabase.mdb"
.Mode = adModeShareExclusive
.Open
End With

cnData.Execute "ALTER DATABASE PASSWORD mynewpassword NULL"

Regards

Gerard O'Donnell

"Chris Huddle" wrote:

> Does anyone know how to programatically set a password for an Access
> Database, preferably in ADO? Thanks! - Chris
>
>
>

 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      24th Aug 2004
Great code..I needed something like that. Next question, how do you open an
Access database that is password protected>

"Gerard O'Donnell" wrote:

> Hi Chris,
>
> This code will set a password to a previously unprotected Access database:
>
> Dim cnData As ADODB.Connection
> Set cnData = New ADODB.Connection
> With cnData
> .Provider = "Microsoft.Jet.OLEDB.4.0"
> .ConnectionString = "Data Source=c:\mydatabase.mdb"
> .Mode = adModeShareExclusive
> .Open
> End With
>
> cnData.Execute "ALTER DATABASE PASSWORD mynewpassword NULL"
>
> Regards
>
> Gerard O'Donnell
>
> "Chris Huddle" wrote:
>
> > Does anyone know how to programatically set a password for an Access
> > Database, preferably in ADO? Thanks! - Chris
> >
> >
> >

 
Reply With Quote
 
=?Utf-8?B?R2VyYXJkIE8nRG9ubmVsbA==?=
Guest
Posts: n/a
 
      24th Aug 2004
Hi Dennis,

To open a password protected Access database you've got to include the
Password in the Properties collection of the ADO connection.

Dim cnData As ADODB.Connection
Set cnData = New ADODB.Connection

With cnData
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=c:\mydatabase.mdb"
.Properties("Jet OLEDBatabase Password") = "existingpassword"
.Mode = adModeShareExclusive
.Open
End With

Regards,

Gerard O'Donnell

"Dennis" wrote:

> Great code..I needed something like that. Next question, how do you open an
> Access database that is password protected>
>
> "Gerard O'Donnell" wrote:
>
> > Hi Chris,
> >
> > This code will set a password to a previously unprotected Access database:
> >
> > Dim cnData As ADODB.Connection
> > Set cnData = New ADODB.Connection
> > With cnData
> > .Provider = "Microsoft.Jet.OLEDB.4.0"
> > .ConnectionString = "Data Source=c:\mydatabase.mdb"
> > .Mode = adModeShareExclusive
> > .Open
> > End With
> >
> > cnData.Execute "ALTER DATABASE PASSWORD mynewpassword NULL"
> >
> > Regards
> >
> > Gerard O'Donnell
> >
> > "Chris Huddle" wrote:
> >
> > > Does anyone know how to programatically set a password for an Access
> > > Database, preferably in ADO? Thanks! - Chris
> > >
> > >
> > >

 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      25th Aug 2004
Thanks. I wasn't sure of the syntax. This will help me a lot in what I'm
working on.

"Gerard O'Donnell" wrote:

> Hi Dennis,
>
> To open a password protected Access database you've got to include the
> Password in the Properties collection of the ADO connection.
>
> Dim cnData As ADODB.Connection
> Set cnData = New ADODB.Connection
>
> With cnData
> .Provider = "Microsoft.Jet.OLEDB.4.0"
> .ConnectionString = "Data Source=c:\mydatabase.mdb"
> .Properties("Jet OLEDBatabase Password") = "existingpassword"
> .Mode = adModeShareExclusive
> .Open
> End With
>
> Regards,
>
> Gerard O'Donnell
>
> "Dennis" wrote:
>
> > Great code..I needed something like that. Next question, how do you open an
> > Access database that is password protected>
> >
> > "Gerard O'Donnell" wrote:
> >
> > > Hi Chris,
> > >
> > > This code will set a password to a previously unprotected Access database:
> > >
> > > Dim cnData As ADODB.Connection
> > > Set cnData = New ADODB.Connection
> > > With cnData
> > > .Provider = "Microsoft.Jet.OLEDB.4.0"
> > > .ConnectionString = "Data Source=c:\mydatabase.mdb"
> > > .Mode = adModeShareExclusive
> > > .Open
> > > End With
> > >
> > > cnData.Execute "ALTER DATABASE PASSWORD mynewpassword NULL"
> > >
> > > Regards
> > >
> > > Gerard O'Donnell
> > >
> > > "Chris Huddle" wrote:
> > >
> > > > Does anyone know how to programatically set a password for an Access
> > > > Database, preferably in ADO? Thanks! - Chris
> > > >
> > > >
> > > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't open my Access files after conversion from Access 97 to Access 2003 M Shafaat Microsoft Access 5 10th Apr 2010 09:04 PM
Saving Access 2007 database in Access 2003 format fails in Access =?Utf-8?B?U3Bpcm8=?= Microsoft Access External Data 0 13th Aug 2006 08:37 AM
W2K3 Service w/ UNC Access, Local Disk Access, and DB Access Rob Microsoft C# .NET 6 2nd Aug 2004 01:44 PM
Access "showing images on first page only of very wide Access report. Windows XP, Access XP Jack Microsoft Access Reports 4 18th Nov 2003 03:01 PM
Re: Allowing users (w/o MS Access) to access an Access 2000 database Wayne Morgan Microsoft Access 0 29th Sep 2003 11:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:05 PM.