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