Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password protect forms

Status
Not open for further replies.

donut

Technical User
Apr 5, 2001
1
US
I created a form that have buttons that open other forms. I need to somehow password protect these other forms so only people granted permission can open the forms and input data. Can I do it with the DLookup function and tables? Thanks Chuck
 
Hi Chuck,
Are you using Access security? If you have to "log in" to Access then you could use something like this in the forms "On Open" event (in Visual Basic):

Private Sub Form_Open(Cancel As Integer)

On Error GoTo FOErr
If CurrentUser()<> &quot;Chuck&quot; Then
Cancel = True
MsgBox &quot;Permission denied.&quot;, vbCritical, &quot;Security Verification.&quot;
End If

FOExit:
Exit Sub
FOErr:
MsgBox Err.Description, vbInformation, &quot;Security Verification error.&quot;
Resume FOExit

End Sub
:)
Gord
ghubbell@total.net
 
In Access/User and Group Permissions you can set access to each form individually or by group. Then you should just trap for the error of no access.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top