|
Regina Whipp |
|
The difficult I do immediately, the impossible takes a little bit longer. |
Let your Client customize their labels |
|
Sometimes you want to give your Client the opportunity to ‘create’ your own labels. The above subform is attached to a Disciplinary menu. Name each Label, which is actually a Text Box, txt1Label thru txt9Label. The unassigned Labels are yellow.
To keep the ones that already filled in locked from editing place the below code on the Forms On_Current event procedure...
Dim LabelNumber As Long LabelNumber = 1
Do Until LabelNumber > 9 If Not IsNull(Me("txt" & LabelNumber & "Label")) Then Me("txt" & LabelNumber & "Label").Locked = True Else Me("txt" & LabelNumber & "Label").Locked = False Me("txt" & LabelNumber & "Label").BackColor = 13303807 End If
LabelNumber = LabelNumber + 1 Loop
If LabelNumber > 9 Then 'Stops cycling after 9 resets to 1 LabelNumber = 1 End If
Just in case the Client wants to change the defaults, place this code on Labels txt2Label_DblClick event procedure...
If IsNull([txt2Label]) Then Exit Sub
Dim Msg, Style, Title, Response, MyString Msg = "Did you want to change this Violation?" Style = vbYesNo + vbQuestion + vbDefaultButton2 Title = "Violation Type"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then MyString = "Yes" Me.txt2Label = "" Me.txt2Label.Locked = False Me.txt1Label.BackColor = 13303807 Else MyString = "No" DoCmd.CancelEvent End If |
|
Forms |