Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Tweak ADO to use a DB password

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
XP - 20 Nov 2006 15:36 GMT
I have the following function which uses JET to return a disconnected
recordset; this runs great.

I just need to tweak this function to work with a password protected (i.e. a
database password) Access DB file, can someone show me how best to accomplish
this:

Public Function ADOReturnDisconnectedRecordsetJET(argFullNameDB As String,
argSQL As String) As ADODB.Recordset
'RETURNS A DISCONNECTED ADO RECORDSET TO THE CALLING SUBROUTINE OR FUNCTION
Dim cnAccess As ADODB.Connection
Dim rsAccess As ADODB.Recordset
Set cnAccess = New ADODB.Connection
cnAccess.Provider = "Microsoft.Jet.OLEDB.4.0"
cnAccess.ConnectionString = argFullNameDB
cnAccess.CursorLocation = adUseClient
cnAccess.CommandTimeout = 0    'NO TIMEOUT
cnAccess.Open
Set rsAccess = New ADODB.Recordset
rsAccess.MaxRecords = 0   '0 = ALL RECORDS
Set rsAccess = cnAccess.Execute(argSQL)
Set rsAccess.ActiveConnection = Nothing    'SEVER CONNECTION
Set ADOReturnDisconnectedRecordsetJET = rsAccess.Clone(adLockReadOnly)  
'RETURN CLONE
If rsAccess.State = adStateOpen Then rsAccess.Close
Set rsAccess = Nothing
cnAccess.Close
Set cnAccess = Nothing
End Function

Thanks much.
Stefan Hoffmann - 20 Nov 2006 16:00 GMT
hi,

> I have the following function which uses JET to return a disconnected
> recordset; this runs great.
> I just need to tweak this function to work with a password protected (i.e. a
> database password) Access DB file, can someone show me how best to accomplish
> this:
Connectionstrings.com

or

create a file with the extension .udl on your desktop. Double click it.
Connect to your password protected .mdb.

Open the .udl file with notepad.

mfG
--> stefan <--
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.