Minddumps
Registered User.
- Local time
- Yesterday, 19:51
- Joined
- Jul 5, 2011
- Messages
- 73
I was provided code to allow Access to read multiple tags to allow access to certain command buttons within my database:
the InStr was to allow me to input multiple UserAccessID's in my tags; however, I just learned today that it doesn't block the command button as long as the tag is above 0 (er so I assume as above it states UserAccessID >0) Well that definitely doesn't solve my issue
This is an example of what is in one of my cmd button tag properties: "1,7,8,9,10,11,12,13,14,15,16"
Anyone know what to change in order to fix the problem I'm having?
Code:
Private Sub Form_Open(Cancel As Integer)
Dim ctl As Control
'Users 1 and 7 have access to all buttons
If UserAccessID = 1 Or UserAccessID = 7 Then
For Each ctl In Me.Controls
If ctl.ControlType = acCommandButton Then
ctl.Enabled = True
End If
Next
Else
'Enable the button only if the UserID is in the Tag property
For Each ctl In Me.Controls
If ctl.ControlType = acCommandButton Then
'use the InStr function to see if the UserID is in the Tag
ctl.Enabled = InStr(ctl.Tag, UserAccessID) > 0
End If
Next
End If
End Sub

Anyone know what to change in order to fix the problem I'm having?