check user then disable/enable command buttons

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
 
D

Douglas J. Steele

If CurrentUser() <> "admin" And _
CurrentUser() <> "john" And_
CurrentUser() <> "craig" Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top