Create a password protected form or report in Access2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've created a switchboard with about 20 groups in ACCESS 2003. Each group
has a report they want to access. Each group has about 3 or 4 users.

I want to password protect each report for each group of users. There are
instructions to accomplish this for Access 95, 97 and 2000, but not for 2003.
Is it at least the same for 2003???
 
Here is what I usually do for forms. I don't generally work in the reporting
end, so I don't know how well this transfers.

Create a table to hold the password, tPassword, with a field for the password.
In the forms OnLoad event, create a recordset, rst.

Set rst = New ADODB.Recordset
Set cn = Currentproject.Connection (or whatever connection you will use)

Dim iBox As String

rst.open "SELECT * FROM tPassword", cn

iBox = InputBox ("Please Enter Password", vbOkOnly, "Password Required")

if rst!Password <> iBox Then
MsgBox "Incorrect Password"
DoCmd.Quit (or whatever else you want to happen to keep the user out of the
form)
Exit Sub
End If


If the PW is correct, nothing else happens, the form opens. If it is
incorrect, the DB closes.

I like to use this method because I also append the users network name and
use it to generate a report showing who tried to access a form.

If you have the same users and they don't change often, you may want to
consider putting code in the form or report that limits who can open it based
on the network ID. Look up fOSUserName(). I use it set which controls on
which forms are available. It works well for me because I have a static pool
of users and they have well defined functions. If you have a group that
changes a lot, the PW route may work better.

If anyone else has any suggestions on a better way, please share!

PJ
 
Thanks PJ, I will do this when I return to work tomorrow. I'll let you know
how I made out.

Joan at the VA
 
Well, I tried your suggestion. It worked awesome. There is only one thing;
the table for the passwords, when I put one in the table for a specific
group, that password also opens every other report. I want to prevent that. I
want each user to have a password for only their report, and not everyone
else’s. How do I accomplish that?

ie: I assign the Administrator ADMIN for a password. It not only opens the
Administrator's reports, it also opens all the reports by using ADMIN for the
password.
 
Well, I tried your suggestion. It worked awesome. There is only one thing;
the table for the passwords, when I put one in the table for a specific
group, that password also opens every other report. I want to prevent that. I
want each user to have a password for only their report, and not everyone
else’s. How do I accomplish that?

ie: I assign the Administrator ADMIN for a password. It not only opens the
Administrator's reports, it also opens all the reports by using ADMIN for the
password.

Alass!!! I found out how to do this. I created a table for each group, but
there is still one more problem. I can see the password when I type it to
open the report. How do I code so when I type the password to open the
report, all I see are asterisks?

Thanks for you help,
Joan at the VA
 
Back
Top