Enable/Disable form buttons base on username (1 Viewer)

xaysana

Registered User.
Local time
Today, 20:19
Joined
Aug 31, 2006
Messages
94
Hi there,

I have created a logon form for different level users to login to access database. After user enters username and password will open up the mainform. In the main form, there some command buttons. I would like to disable some buttons when guest user in read only group login. at the same time they should become enable when admin user login.
These are user info:

Username group
admin admin
guest read only


Here is my code but it does not work:

Private Sub Form_Load()
If Forms![frmLogon]![cboEmployee] = "guest" Then
Me.Command27.Enabled = False
Me.btproduction.Enabled = False

Else
Me.Command27.Enabled = True
Me.btproduction.Enabled = True

End If

End Sub

I would appreciate for any help
Cheers,
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:19
Joined
Jul 9, 2003
Messages
16,335
If you take away the “IF statement” does the enabling and disabling work OK?

If it does work OK, then my guess is that the word “guest” in this statement

If Forms![frmLogon]![cboEmployee] = "guest" Then

Should possibly be a number?
 

xaysana

Registered User.
Local time
Today, 20:19
Joined
Aug 31, 2006
Messages
94
If you take away the “IF statement” does the enabling and disabling work OK?

If it does work OK, then my guess is that the word “guest” in this statement

If Forms![frmLogon]![cboEmployee] = "guest" Then

Should possibly be a number?

This works fine on my project. Thank you for your advice.
 

Users who are viewing this thread

Top Bottom