OpenReport Method and Access security [RESOLVED]
I have a report that is being printed from a vb application, my concern is will the following code work on the password protected database??? and if it won't is there a way to get around it?
Set AccessDB = New Access.Application
AccessDB.OpenCurrentDatabase strDB
AccessDB.DoCmd.OpenReport strReport, acViewPreview, strFilter, strWhere
AccessDB.Visible = True
Set AccessDB = Nothing
Re: OpenReport Method and Access security
No, your current code will not open a password protected database. All it needs is a simple syntax
change to specify shared open mode and also to pass the password.
VB Code:
Set AccessDB = New Access.Application
AccessDB.OpenCurrentDatabase strDB, False, "YourPassword"
AccessDB.DoCmd.OpenReport strReport, acViewPreview, strFilter, strWhere
AccessDB.Visible = True
Set AccessDB = Nothing
:D
Re: OpenReport Method and Access security
doesn't seem to work for access 2000 :sick:
Re: OpenReport Method and Access security
Give me a minute and I will test on my other system w/2000.
Re: OpenReport Method and Access security
Ok, heres the bad news. Access 200 does not support the password parameter. The "good" (I guess) news is
that it started support on Access XP.
The DoCmd command is only available when using the Access Application Object and not in DAO.
There are other methods to display a Report object like the SysCmd object.
Re: OpenReport Method and Access security
how does the SysCmd command work and will it allow me to use a password parameter. Rob, I can't thank you enough for your help.
Re: OpenReport Method and Access security
Seems that the SysCmd can only get the status of the object passed to it and not actually instanciate an
instance of a Report. :(
I'll look for another way to show a Report.
Re: OpenReport Method and Access security
Quote:
Originally Posted by RobDog888
I'll look for another way to show a Report.
How about Access 2003? Does it have the capability to pass the pasword parameter to the OpenCurrentDatabase statement?
Re: OpenReport Method and Access security
Access 2002 (XP) and 2003 do have that ability. Is that an option to upgrade?
Re: OpenReport Method and Access security
no upgrade is necessary :) the client that i am writing for has Access 2003 as a standard application, I am writing the application with Access 2000 for a backend, thus it works itself out. RobDog you've been extremely helpful in this matter. Thanks a million. :wave: :bigyello:
Re: OpenReport Method and Access security
Cool! Easy fix :D Always glad to help. :thumb:
Edit: just noticed that you have been a member for a few years :eek:
Glad to see you back.
Re: OpenReport Method and Access security
Yeah, I used to be a programmer, then I lost my job for a while, now i'm trying to get back to the market. hopefully everything will work out. Thanks again Rob.
Re: OpenReport Method and Access security [RESOLVED]
a new problem arose on a horizon, :sick: . I thought that by adding the passowrd parameter to my code will set me home free, but when trying to comple the executable it gave me a compile error wrong nuber of arguments. is there a way to reference Access 11 object library without having access 2003? what is the procedure for that?
Re: OpenReport Method and Access security [RESOLVED]
Yes, you need to do Late Binding instead of Early Binding. When you late bind vb doesnt check for the needed references when compiling. When you run your program you need to have 2003 installed.
When you late bind you dont get the intellisense since vb doesnt know what object you are referencing to.
Also remove the reference to Access after you modify the code as follows.
VB Code:
Dim AccessDB As Object
Set AccessDB = CreateObject("Access.Application")
AccessDB.OpenCurrentDatabase strDB, False, "YourPassword"
AccessDB.DoCmd.OpenReport strReport, acViewPreview, strFilter, strWhere
AccessDB.Visible = True
Set AccessDB = Nothing
Re: OpenReport Method and Access security [RESOLVED]
Thanks Rob, once again you are the man!!!! :)
Re: OpenReport Method and Access security [RESOLVED]
No prob. Glad to help. :D