Option Explicit
Option Compare Text
Private Function DisplayControlName(ByVal strControlName As String)
If strControlName = "Detail" Then
Me.txtMyTextBox = ""
Else
Me.txtMyTextBox = Me(strControlName)
End If
End Function
Private Sub Form_Open(ByRef intCancel As Integer)
Dim ctl As Control
Const conHandler As String = "=DisplayControlName("
For Each ctl In Me
If ctl.Tag = "Include in collection" Then
ctl.OnMouseMove = conHandler & Chr$(34) & ctl.Name & Chr$(34) & ")"
End If
Next ctl
Me.Section(acDetail).OnMouseMove = conHandler & Chr$(34) & "Detail" & Chr$(34) & ")"
End Sub