Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Hide/Show lable based on login information

Author  Topic 

egghi
Starting Member

17 Posts

Posted - 2006-10-16 : 15:39:55
Hi,

I have a label called lblOpenAdmin on an Access form. If the logged in user's user role (user role is defined and stored on a SQL table called UserRol) is "PIPAdmin", the label will be visible to the user. My VBA was working earlier today, and I don't remember making any changes to it, but hey, it's not working now... Any help will be appreciated!

Dim strAdmin As String
Dim strWindowsUser

strAdmin = "'PIPAdmin'"
strWindowsUser = Me.txtUserName.Value

If DCount("WindowsUser", "UserRole", "WindowsUser= '" & strWindowsUser & "' AND UserRole IN (" & strAdmin & ")") <> 0 Then
Me.lblOpenAdmin.Visible = True
Else
Me.lblOpenAdmin.Visible = False
End If
   

- Advertisement -