Report Security Button

G

Guest

How do I create a command for a button that if someone is logged on they can
only view this report if they are authorized to or they have to log in to the
report in order to view it. Example:

If "Brooks" or "Rotunno" is logged in they can only view the "rptsalesreport"

Is there an expression I can write to assign only certain people to view
this particular report?

I have the securities in place but even when I assign permission to
different reports other folks can still view them.

Hopefully that made sense? So far this message board forum has been a life
savor for me!
 
T

TC

Presumeably there is already a button which runs that report. The code
for it, would look something like this:

private sub cmdBLAH_Click (cancel as integer)
docmd.openreport ....
end sub

You just need to add the lines in ALL CAPS:

private sub cmdBLAH_Click (cancel as integer)
SELECT CASE CURRENTUSER()
CASE "Brooks", "Rotunno"
docmd.openreport ....
CASE ELSE
MSGBOX "Sorry, you are not authorized to run this report"
END SELECT
end sub

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top