K
Kenny G
Hello,
Below is the code I have in the Form Properties of a Form and on the Events
Tab in the BeforeUpdate area under that tab. This code works great except I
need to say if the control is enabled = false then go to next control.
How could I change the code for this extra addition.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim blnContinue As Boolean
Dim ctl As Control
blnContinue = True
For Each ctl In Me.Controls
If ctl.Tag = "Required" Then
If IsNull(ctl) Then
MsgBox "You must fill in the " & ctl.ControlSource & " field."
Cancel = True
ctl.SetFocus
Exit For
End If
End If
Next ctl
Set ctl = Nothing
Me.LastUpdate = Now()
End Sub
Thanks,
Below is the code I have in the Form Properties of a Form and on the Events
Tab in the BeforeUpdate area under that tab. This code works great except I
need to say if the control is enabled = false then go to next control.
How could I change the code for this extra addition.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim blnContinue As Boolean
Dim ctl As Control
blnContinue = True
For Each ctl In Me.Controls
If ctl.Tag = "Required" Then
If IsNull(ctl) Then
MsgBox "You must fill in the " & ctl.ControlSource & " field."
Cancel = True
ctl.SetFocus
Exit For
End If
End If
Next ctl
Set ctl = Nothing
Me.LastUpdate = Now()
End Sub
Thanks,