Talismanic
Registered User.
- Local time
- Today, 09:25
- Joined
- May 25, 2000
- Messages
- 377
I have a form with 15 textbox controls, 10 of them are required fields. I have a button that I am using to update the table and start a new record. Now I want to check for null values in the 10 fields before the data goes to the table and then mark the "bad" records to the user by turning the label red.
I know I could do it with a series of Case Selects or If Thens like this:
If IsNull(Me.WeekEndHD) Then
Cancel = True
WeekEndHD.SetFocus
lblWeekEndHD.ForeColor = vbRed
ElseIf IsNull(Me.PayDate) Then
Cancel = True
PayDate.SetFocus
lblPayDate.ForeColor = vbRed
etc.....
The only problem I have doing it this way, besides all the extra typing is that it can only validate and mark one record at a time. How can do the whole form at once?
I know I could do it with a series of Case Selects or If Thens like this:
If IsNull(Me.WeekEndHD) Then
Cancel = True
WeekEndHD.SetFocus
lblWeekEndHD.ForeColor = vbRed
ElseIf IsNull(Me.PayDate) Then
Cancel = True
PayDate.SetFocus
lblPayDate.ForeColor = vbRed
etc.....
The only problem I have doing it this way, besides all the extra typing is that it can only validate and mark one record at a time. How can do the whole form at once?