Running a Report in a Passworded Access Db

Ed James
12-07-2000, 03:22 PM
From VB, I'm trying to run an Access report contained in an Access db which is passworded. I have done this for a non passworded db as follows:

Set appAccess = New Access.Application
appAccess.Visible = False
appAccess.OpenCurrentDatabase strDB
appAccess.DoCmd.OpenReport strReportName,acViewPreview

The OpenCurrentDatabase doesn't take a password as an argument and an Application object is needed to get at DoCmd which is needed to call OpenReport.

Alternatively something like the following will return a db object opened with a specified password.

Set dbs = appAccess.DBEngine.Workspaces(0).OpenDatabase("C:\Access.mdb", False, False, ";pwd=blaaa")

Does anyone know how to combine the OpenDatabase method (which copes with a password) with the need to get at the DoCmd in order to run a report ? Any other suggections ?

whelanp
12-08-2000, 03:37 AM
There is no way to specify a password for an Access Db via Automation. ie Set AppAccess = new Access.Application.


Using DAO ie OpenDatabase there is no way to use DoCmd in order to open your report.

This is the case with Access 97. It might be different with 2000.


There MUST be a way around this, but due to serious hangover I can not think straight at present.

I'll give it a go later on today and re-post with the results.

norm
10-15-2002, 10:33 AM
Here is a link to a solution for a different topic but it contains DAO code that uses a password to create an ODBC workspace and may help...


http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=35773

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum