I need to have a form that will show prices for some people and hide from others, but it's a listbox
I need to have a form that will show prices for some people and hide from others,开发者_如何学C but it's a listbox. How do I do? The only solution I found is to change the cols width, but is not really...
You could set the Listbox or combo box rowsource / recordsource details based on Windows login or Access login if you have built in security.
Some sort of If statement in conjuntion with the Login API, which you could find by googling. An example would be kind of like below (do this on the on load event maybe?) -
Dim UserName As String
UserName = GetUserName_TSB 'this is the windows login drawn from the LoginAPI function
If UserName = "XXXX" Or UserName = "XXXXX" Or UserName = "XXXXX" Or UserName = "XXXX" Then
Me.combobox.rowsource = 'Create a SELECT SQL query for whatever your tables / data is.
Else
Me.combobox.rowsource = 'Create a SELECT SQL query for whatever your tables / data is for other users
End If
精彩评论