chanman525
IS-IT--Management
I have some code that is setup on a form to determine if required fields have been populated. They are required in the table but I wanted to specify the field they missed and set the focus to that field. It works great except when they choose "Next" and it goes to a new record. Then when you click "Previous" it states that a field is null, click OK and then goes to the previous record. (the previous and next button calls the sub below as well)So how do I get it to just move back a record without prompting for the null field when they "Next" to many times? Or is there a way to stop that and force them to click the New record button to get to a new record? I don't want the form to be data entry only becasue they can browse through all the records to view all the projects recorded.
Here is the code for the field verification:
I understand this is probably not the best way to handle this but my attempt was to try and steamline the required fields and the interface to the user. Any input or suggestions would be appreciated, and thank you for your time!
A2
Here is the code for the field verification:
Code:
Private Sub Verify()
If Me.NewRecord Then
If Me.Status.Value <> "Closed" Then
If IsNull(Me.ProjectName) Then
MsgBox "A Project Name has not been identified!", vbExclamation, "Required field is missing data"
Me.ProjectName.SetFocus
Exit Sub
ElseIf IsNull(Me.Details) Then
MsgBox "Details of the project have not been identified!", vbExclamation, "Required field is missing data"
Me.Details.SetFocus
Exit Sub
ElseIf IsNull(Me.DueDate) Then
MsgBox "A Due Date has not been identified!", vbExclamation, "Required field is missing data"
Me.txtDueDate.SetFocus
Exit Sub
ElseIf IsNull(Me.Category) Then
MsgBox "A Category has not been identified!", vbExclamation, "Required field is missing data"
Me.Category.SetFocus
Exit Sub
ElseIf IsNull(Me.Severity) Then
MsgBox "A Severity has not been identified!", vbExclamation, "Required field is missing data"
Me.Severity.SetFocus
Exit Sub
ElseIf IsNull(Me.Requestor) Then
MsgBox "A Requestor has not been identified!", vbExclamation, "Required field is missing data"
Me.Requestor.SetFocus
Exit Sub
End If
End If
End If
End Sub
I understand this is probably not the best way to handle this but my attempt was to try and steamline the required fields and the interface to the user. Any input or suggestions would be appreciated, and thank you for your time!
A2