check user then disable/enable command buttons

  • Thread starter Thread starter john
  • Start date Start date
J

john

can some one help me with this bit of code (im a beginner) im trying to
determin wether certain users (admins) are logged on if not then disable
some command buttons (im using a secured.mdw file) ive tried useing
different combinations but no luck!!!!!

(from my switchboard)


Private Sub Form_Open(Cancel As Integer)
'check to see if the user is an administrator
If CurrentUser() Is Not "admin" Or "john" Or "craig" Then

'if not disable admin features
Forms!frmForm!Command37.Enabled = False
Forms!frmForm!Command32.Enabled = False

Else
'if yes then enable
Forms!frmForm!Command37.Enabled = True
Forms!frmForm!Command32.Enabled = True


End Sub
 
If CurrentUser() <> "admin" And _
CurrentUser() <> "john" And_
CurrentUser() <> "craig" Then
 
Back
Top