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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP PASSWORDING A FORM, HERE'S MORE DETAIL... 1

Status
Not open for further replies.

chubby

Programmer
Apr 28, 2001
278
US
More than one person needs access to (personnel) form to update personnel records. Is there an easy why to change my code to accomplish this. I'm using Access 97 security I.E. and logging in as chubby. On the open event of my form (in Visual Basic), I did placed the following code and it works fine, but only for one person, all other users are denied access.

Private Sub Form_Open(Cancel As Integer)
On Error GoTo ErrFO
If CurrentUser()<> &quot;chubby&quot; Then
MsgBox &quot;Permission denied.&quot;, vbCritical, &quot;Security Check.&quot;
Cancel = True
End If
ExitFO:
Exit Sub
ErrFO:
MsgBox Err.Description, vbInformation, &quot;Form Open Error.&quot;
Resume ExitFO
End Sub
 
This looks too simple but why don't you use some logic in your if statement

if ((currentuser() <> &quot;chubby&quot;) and (currentuser() <> &quot;annie&quot;) and (currentuser() <> &quot;nora&quot;) and (curentuser() <> &quot;uncle albert&quot;)) then
msgbox &quot;please p off.&quot;
cancel = True
end if


all done ;-)
 
WOW, thanks!!! I really need to get hot and learn VBA and stop cutting and pasting other people code in my db...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top