Ok, I've got this partially working but can't get it the rest of the way for some reason. I have a login form that has a drop down menu with everyones user id in it, then a password field to input their password. I already have the validation code set and that works fine. Where my problem lies is with restricting buttons on the main form. I have the following code on the "onload" function of the main form that opens up after the login validation.
Private Sub Form_Load()
Admin = DLookup("[Group]", "login", "UserID = '" & (Combo11) & "'")
Super = DLookup("[Group]", "login", "UserID = '" & (Combo11) & "'")
If Nz(Admin) = Admin Then
Me.update.Visible = False
End If
If Nz(Super) = Super Then
Me.update.Visible = True
End If
End Sub
I should mention that I have a table that has 3 fields in it....UserID, Password and Group. This where the validation looks to see if the userid and the password is. I want the "onload to go into this table, look at the userid that was logged in and check what group they are associated with. From there limit the buttons based off of the group the user is associated with. The above code still makes the update button visible to anyone. However if I take out the second if statement it works perfectly. Unfortunately I need multiple if statements. Also, I can not use the code to grab the NT userid because of traveling purposes. Any help would be greatful.
Thanks
jnp102
Private Sub Form_Load()
Admin = DLookup("[Group]", "login", "UserID = '" & (Combo11) & "'")
Super = DLookup("[Group]", "login", "UserID = '" & (Combo11) & "'")
If Nz(Admin) = Admin Then
Me.update.Visible = False
End If
If Nz(Super) = Super Then
Me.update.Visible = True
End If
End Sub
I should mention that I have a table that has 3 fields in it....UserID, Password and Group. This where the validation looks to see if the userid and the password is. I want the "onload to go into this table, look at the userid that was logged in and check what group they are associated with. From there limit the buttons based off of the group the user is associated with. The above code still makes the update button visible to anyone. However if I take out the second if statement it works perfectly. Unfortunately I need multiple if statements. Also, I can not use the code to grab the NT userid because of traveling purposes. Any help would be greatful.
Thanks
jnp102