Private Sub Form_Current()
10 On Error GoTo Err_Form_Current
Dim sfCtlName As String, ctl As Control
20 With Me
30 On Error Resume Next
40 With .Parent
50 For Each ctl In .Controls
60 If ctl.ControlType = acSubform Then
70 If ctl.SourceObject = Me.Name Then
80 sfCtlName = ctl.Name
90 Exit For
100 End If
110 End If
120 Next ctl
130 End With
140 If Err Then Debug.Print "Not a subform"
150 On Error GoTo 0
160 Debug.Print "Subform control name:", sfCtlName
170 If Len(sfCtlName) = 0 Then
180 Debug.Print "Not a subform"
190 Exit Sub
200 End If
210 .Parent.Controls(sfCtlName).Locked = Nz(.txtStatus, vbNullString) = "Billed"
220 With .txtLocked
230 If .Parent.Parent.Controls(sfCtlName).Locked Then
240 .Value = "Form is locked"
250 .BackColor = 421882
260 Else
270 .Value = "Form is unlocked"
280 .BackColor = 5167783
290 End If
300 End With
310 End With
Exit_Form_Current:
320 Exit Sub
Err_Form_Current:
330 Select Case Err.Number
Case Else
340 MsgBox "Error No.: " & Err.Number & vbNewLine & vbNewLine & _
"Description: " & Err.Description & vbNewLine & vbNewLine & _
"Sub: Form_Current" & vbNewLine & _
IIf(Erl, "Line No: " & Erl & vbNewLine, "") & _
"Module: " & Application.VBE.ActiveCodePane.CodeModule.Name, , _
"Error: " & Err.Number
350 End Select
360 Resume Exit_Form_Current
End Sub