I'm trying to validate two fields, hours and descriptionofTask. They can't be blank, there seem like it could be done better. Also the message when the user tries to close out is YOu can't save this record at this time, can you change this? if so how?
Private Sub Form_BeforeUpdate(Cancel As Integer)
Const strTitle As String = "Time Tracking - Program Development"
If IsNull(Me.DescriptionofTask) Then
MsgBox "You must select an activity from the list", vbOKOnly, strTitle
Cancel = True
DescriptionofTask.SetFocus
DescriptionofTask.ForeColor = vbRed
If IsNull(Me.Hours) Then
Hours.SetFocus
Hours.ForeColor = vbRed
End If
End If
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Const strTitle As String = "Time Tracking - Program Development"
If IsNull(Me.DescriptionofTask) Then
MsgBox "You must select an activity from the list", vbOKOnly, strTitle
Cancel = True
DescriptionofTask.SetFocus
DescriptionofTask.ForeColor = vbRed
If IsNull(Me.Hours) Then
Hours.SetFocus
Hours.ForeColor = vbRed
End If
End If
End Sub