Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening an Access DB with MS Access Object Library

Status
Not open for further replies.

invincibleian

Programmer
Jan 4, 2001
2
US
My procedure below worked fine until I put a password on the database. Now a "Enter Password" prompt appears. Is there anyway to write the password into my code?


Public Sub fPrintSummary(strReportName)

Dim applAccess As Access.Application

Set applAccess = New Access.Application
applAccess.UserControl = False
applAccess.Visible = False

applAccess.OpenCurrentDatabase "\\Dph_vitals_nt\VtlDev\Administrative File System\FileSystem.mdb", True
applAccess.DoCmd.OpenReport (strReportName)
applAccess.CloseCurrentDatabase
applAccess.Quit acQuitSaveNone
Set applAccess = Nothing

End Sub
 
example :

Dim password As String
password = "edderic"
Dim db As DAO.Database

Rem ** Bepalen van de locatie van de applicatie
strPath = IIf(Right$(App.Path, 1) <> &quot;\&quot;, App.Path & &quot;\&quot;, App.Path)
strAccessFile = &quot;Scriptie01.mdb&quot;
Set db = appAccess.DBEngine.OpenDatabase(strPath & strAccessFile, False, False, &quot;MS Access;pwd=&quot; & password)
appAccess.OpenCurrentDatabase strPath & strAccessFile
Set db = Nothing Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top