K
Kurt
I use controls’ tag property and BeforeUpdate code to validate missing data
on a form. How can I edit the MsgBox below to show the caption of the label
that’s bound to the control, instead the name of the control (ctl.Name)
that’s currently used? Thanks. - Kurt
###
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
For Each ctl In Me
If ctl.Tag = "*" Then
If IsNull(ctl) Or ctl = "" Then
MsgBox "You must complete the required field '" & " " &
ctl.Name & " " & "' before you can continue.", vbCritical, "Required Field"
ctl.SetFocus
Cancel = True
Exit Sub
End If
End If
Next
Set ctl = Nothing
End Sub
on a form. How can I edit the MsgBox below to show the caption of the label
that’s bound to the control, instead the name of the control (ctl.Name)
that’s currently used? Thanks. - Kurt
###
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
For Each ctl In Me
If ctl.Tag = "*" Then
If IsNull(ctl) Or ctl = "" Then
MsgBox "You must complete the required field '" & " " &
ctl.Name & " " & "' before you can continue.", vbCritical, "Required Field"
ctl.SetFocus
Cancel = True
Exit Sub
End If
End If
Next
Set ctl = Nothing
End Sub