hardhitter06
Registered User.
- Local time
- Yesterday, 19:50
- Joined
- Dec 21, 2006
- Messages
- 600
Hello,
I have this code executed when I hit my Save button. It works fine but I just added an additional field SFSID that isn't required each time. If I leave it blank, I still get the error message and can't save my record. I'm not sure how I would exclude one field with my given code. Could some one assist? Thank you.
I have this code executed when I hit my Save button. It works fine but I just added an additional field SFSID that isn't required each time. If I leave it blank, I still get the error message and can't save my record. I'm not sure how I would exclude one field with my given code. Could some one assist? Thank you.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.ControlType = acTextBox Then
If IsNull(ctrl) Then
MsgBox ctrl.Name & " Cannot Be Left Empty!"
Cancel = True
ctrl.SetFocus
Exit Sub
End If
End If
Next
MsgBox "Record Saved!"
End Sub