Thank you for the reply Micron, yes it is a split DB and it is accde. First let me say that sometimes I'll post due to the need to fix something right now and sometimes my post are something that i saw posted that intrigues me that i would like to learn. In this case its kind of both. i currently do something similar to what you are describing using the fosusername and a table of user names and their levels but then on each form I start by calling a function on that form with a case select listing each level and the command buttons that will have properties enabled and visible set to false. this actually works great and gives me the ability to hide administrative forms from those that don't need it or for myself it unlocks all the ribbon commands, but this adds a lengthy function being called from each form upon form load. If I want to change or add the level of a button it involves going thru the code of each form, finding the right place in the function and hoping i got them all
What i liked about ranman's use of the tag property was that i could set each command buttons tag property to its user level and change my select case to call the tag property and set enable and visible based on that. Actually my main confusion at looking at both ranman's code and yours was that both of you were calling text box's and combo boxes and was not sure how to call a command button. With a little more research this morning i found the msdn accontroltype enumeration at https://msdn.microsoft.com/en-us/lib...ffice.15).aspx and was able to figure out that i needed to be calling accommandbutton. so far here is what i have, in my test form i have 10 command buttons with different values in the tag property. Then i have a extra command button on the form to call this function
Code:
Private Sub test()
Dim ctl As Control
For Each ctl In Me.FormHeader.Controls
If ctl.ControlType = acCommandButton Then
Select Case ctl.Tag
Case Is = 1
ctl.ForeColor = RGB(255, 255, 0) 'yellow
Case Is = 2
ctl.ForeColor = RGB(0, 0, 255) 'blue
Case Is = 3
ctl.ForeColor = RGB(255, 0, 0) 'red
Case Is = 4
ctl.ForeColor = RGB(255, 128, 0) 'orange
Case Is = 5
ctl.ForeColor = RGB(0, 128, 0) 'green
Case Is = 6
ctl.ForeColor = RGB(255, 255, 255) 'white
Case Else
ctl.ForeColor = RGB(0, 0, 0) 'black
End Select
End If
Next
End Sub
So far this is working great(please make sure you don't see anything wrong) and should not be hard to add the user level which is called and stored on each form as a hidden unbound text box during form load and then change the color change to enable and visible to false.
This should simplify my code a little but now I'm wondering what would it take to put this in a module? Can i control a forms controls from a called module? I'll keep researching, if anyone has any thoughts or help please post.