Link to home
Start Free TrialLog in
Avatar of alam747
alam747

asked on

Access report print control

Would you please advice how to add restriction for printing the report file. Any user can preview the report but need password to print out the report. How can I add this criteria in the report print/preview.

Thanks
Avatar of Mike McCracken
Mike McCracken

I think you would have to disable the system print button and add your own.  You could then ask for a password,

mlmcc
You can use On Print event in the report header.
Add your condition (ask for password) and if password is wrong, close report (docmd.close)
I have an Access database where most forms open with POPUP = YES so the normal menus aren't available.  They can only do what is available on the screen.  I added a print button.

It would be easy to add a password check when the button is clicked or if the users login, check the user id or assign them to classes/groups where only some can print so the button doesn't even appear.

mlmcc
Can you elaborate a bit on this requirement?

The issue with this is that we don't know the level of security needed.
For example, why is printing restricted?

There are dozens of ways a use can bypass most attempts to do this in Access:
Screens capture programs
Generating/exporting/saving the report "As" another format, then simply printing that
Printing the raw data behind the report
Writing down the results when the report is viewed
Printing the report via some external application
...etc

How much do you know about Report design and VBA?


JeffCoachman
Avatar of alam747

ASKER

Would you please write the VB to asking for password in On print event.

Thanks
Depending on the sophistication of the users it could be as simple a

  If InputBox("Enter Password : ") = "password" then
     Allow print
  Else
     close print attempt

If you need to you could encrypt the password and save it in a table.
Different passwords for each user
That would obviously require writng an encryption routine and a routine to change passwords.

mlmcc
I hope you have read Jeff's comment.
Code can be following:
If InputBox("Enter Password : ") <> "password" Then DoCmd.Close
alam747,

So you are not concerned with this being easily bypassed?
see my post:
https://www.experts-exchange.com/questions/26989118/Access-report-print-control.html?cid=1572&anchorAnswerId=35514912#a35514912

remember mlmcc also wisely posted:
"Depending on the sophistication of the users..."

Today's users are web, mobile phone, ...etc savvy.
Bypassing something this simple is fairly simple for almost any user...

just my 2c

JeffCoachman
But some users are very, very unsophisticated.  Maybe that is the case here.  I recall one who called me up to ask what to do when the screen said "Press Enter to continue" (that was back in dBASE days).
I asked her if she had tried pressing Enter, and she said "Oh, I never thought of that!"
<But some users are very, very unsophisticated.>
Yes, my point was only that the "Security" level needed was not clearly stated, nor was the reason for needing this.

My concern was that the next question would be:
    "Users are bypassing my "Security", how do I stop this?"
;-)

For example, at my company we locked down remote Internet Access for years using a simple technique.
Then suddenly, one day, "Everybody" knew how to bypass it (after one user figured it out and told everybody else)

The question of preventing Printing comes up often enough where I always state how easily it can be bypassed.
This is why I asked for the reason behind this.

If it is "crucial" that printing be denied, then something a bit more robust may be needed.
My feeling is that if this is crucial, and it was bypassed, the developer here (The OP) may not know about it until it is too late.
:-(


I find that bypassing certain things is a function of how old the user is.
Most of the "mature" users where I work will try to print using the Print Icon, then try File-->Print, then Ctrl-P,  ...then just give up.

Most of the younger users will immediately use the print screen key and paste to Paint to print out something.

Not even really wanting to "hack" the security, but more like a "Tip" or workaround to get a printout if printing normally does not work
For example:
  "Hey, for some reason, I could not print, so I just did a screen dump"

Or...

User A: "Hey, ...I can't print the Report"
User B: "Dude, just export it to a PDF then print the PDF"

;-)

Jeff
<My concern was that the next question would be: "Users are bypassing my "Security", how do I stop this?">
My opinion - access security can start only with some SQL server in background. All other methods are bypassed without problems.
But even with SQL user can use mobile phone for making screenshots and I don't know mehtods for preventing it.
As Helen stated - our users in 99% will not ever try to find alternative solutions and very simple method can be very effective.
I agree, but I still like to let askers know that as long as the output can be "Seen", ..it can be copied (and printed)

;-)
Avatar of alam747

ASKER

I added the following code to report header its asking for password but if I enter wrong password it close the form and preview the report.
Dim strPassword2 As String

strPassword1 = "324576"
If InputBox("Please Enter Password : ") <> strPassword1 Then
    DoCmd.Close
End If

What I am expecting is..
1) while I enter the password it showing every digit entered on the box, would you please tell how can make it invisible like ********* as we normally enter password.
2) while press the print buttom ( a command buttom )in the form it will preview the report but while want to print the form (by rightclick on the previewed report and choose the print menu it will then ask for password, if password is wrong cannot print-out the report or any best suggestion to prevent printout without autorization.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alam747

ASKER

Thanks for your prompt response.
If there any other way to do it , and prevent unauthorized user to print-out the previewed report.

Thanks
How are users printing?

Have you considered not showing the Access print button and default menus?

Do the users have to log into the application?

mlmcc
Avatar of alam747

ASKER

I already done it, no buttom is dispayed , but if I right click on the print-previewed report a menu comes up and allow me to choose and print the report.

Thanks
Did you read my comments on all the ways that any of these techniques can be *easily* bypassed?

Not trying to stop you from using the suggestions here, ...it's just that you never stated the level of security needed, or the reason behind needing this.
So, based on this lack of information, most experts presumed you needed something "simple/basic"

From the exchange above, you seem to need something more than basic/simple.

Can you first take a step back and *clearly* explain the need for this, and state the level of security required please?

Thanks

JeffCoachman
Here's another way:  link to the Access data from Word or Excel, and print it from a Word doc or Excel workbook.  There are so many ways to get data out of Access . . .
<) while I enter the password it showing every digit entered on the box, would you please tell how can make it invisible like ********* as we normally enter password.>
You can create form for password checking. In Form you can use "password" mask.
Avatar of alam747

ASKER

would you please send me simple code for this purpose,
while print button pressed a small pop-up screen(in your concern it will be a form) comes up and ask for password. I am using access 2003.

Thanks
Avatar of alam747

ASKER

Please also want the way that, user can change his password while necessary.
thanks in advance for your help
You have the basic code.

You need to create a form
Put a text box and label on it to prompt for a password
Put a command button on it to allow the user to suubmit the password
Use the code provided to test the password but check the text in the textbox rather than the input box

Do you have a table built to store user names and passwords?
Do the users log in or will they have to type a user name when they type the password?

mlmcc
Avatar of alam747

ASKER

Thanks for your advice