Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Excel Access Security Question

Hi,

I use the code below to query against an Access Database. I would like to
add a password to the database so that it can't be accessed unless you have
the password.

Would anyone know how I would add such a password to Access and how to adapt
the code below to use that password.

Thanks
Neil

Sub QueryAccessDatabase()

Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset


DatabaseLocation = Range("DatabaseLocation").Text
Set conn = New ADODB.Connection
With conn
.Provider = "Microsoft.JET.OLEDB.4.0"
.Open DatabaseLocation
End With


' Create a new Recordset Object.
Set rst = New ADODB.Recordset
With rst
' Connect this recordset to the previously opened connection.
.ActiveConnection = conn
.Open NSelect & NFrom & NWhere, conn,
adOpenDynamic,adLockBatchOptimistic
End With

'This line dictates where the results will be placed.
Sheets("Queries").Range(DestinationCell).CopyFromR ecordset rst

' Close the recordset.
Set rst = Nothing
' Close the Connection.
conn.Close
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Excel Access Security Question

Roedd <<Neily wedi ysgrifennu:

Hi,

I use the code below to query against an Access Database. I would
like to add a password to the database so that it can't be accessed
unless you have the password.

Would anyone know how I would add such a password to Access and how
to adapt the code below to use that password.

Thanks
Neil


In Access ToolsSecuritySet Database Password

In your code:

With conn
.Provider = "Microsoft.JET.OLEDB.4.0"
.Open DatabaseLocation, , "MyPassword"

End With

Rob


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - security / limiting access Paul Excel Discussion (Misc queries) 0 September 2nd 09 02:54 PM
Help! Security when using a VBA macro to access an Excel File biker Excel Programming 0 June 16th 06 05:27 AM
Security for Viewing MS Access Databases From Excel Datasource Sam Wardill Excel Discussion (Misc queries) 0 March 28th 06 03:47 PM
Access security and excel external data tmountjr[_2_] Excel Programming 1 December 2nd 04 10:04 AM
Export Excel data to Access Security problem Annelie[_3_] Excel Programming 5 December 30th 03 11:14 PM


All times are GMT +1. The time now is 11:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"