So as the defect is currently configured, any user can toggle back and forth from locking a record to unlocking a record. The problem I have is how/where to apply validation that prevents anyone except a user in a particular group, from unlocking the record, one it has been locked.
So up to this point, I have been focusing on FieldCanChange, and have used the following if statement:
Function Bug_FieldCanChange(BG_USER_28, N)
On Error Resume Next
If Bug_Fields("BG_USER_28").Value = "Y" AND User.IsInGroup("Unlock-Admins") Then
Bug_FieldCanChange = true
Bug_Fields("BG_USER_28").IsReadOnly = false
Bug_Fields("BG_USER_28).value = "N"
Bug_FieldCanChange = false
On Error GoTo 0
I am also using Sub MoveTo to call the FieldChange sub.
Sorry I am all over the place here...I have been trying to figure out if my syntax is incorrect, or if I am trying to do things inside the event procedures that isnt allowed. So to recap, I have ability to lock and unlock, but once a record in locked, I want to limit who can unlock it. I even tried combinations of If Not User.isingroup, but have not come up with the correct combo.
I would appreciate any insight. I have no issues posting or sending more code to anyone who is interested.
What is the reasoning for locking and unlocking a record?
If the record can only be modified by a certain group, you should disable all the controls by default. You can use the DialogBox procedure in the Common scripts section to disable all controls in the defect screen for people who are not allowed to edit the defect. In the grid, you may have to rely upon the Bug_CanPost event to determine if the user is allowed to save changes
Beantown Tester Go <font color="Red">Red Sox</font>