Hi,
I'm new to VBA and would like to know if there's a more simple way to write out the code below:
Code:
Private Sub Save_and_New_Click()
If IsNull(Me.[BorrowerName]) Or IsNull(Me.[NewRenewalExtensionModification]) Or IsNull(Me.[LDDLogFileCompleteOnArrival]) Or IsNull(Me.[BranchNumber]) Or IsNull(Me.[IncreaseOrDecrease]) Or IsNull(Me.[Amount]) Or IsNull(Me.[LoanOfficer]) Or IsNull(Me.[LDDLogDateTimeCompleted]) Then
MsgBox ("Borrower Information Missing")
End If
If Not IsNull(Me.[BorrowerName]) And Not IsNull(Me.[NewRenewalExtensionModification]) And Not IsNull(Me.[LDDLogFileCompleteOnArrival]) And Not IsNull(Me.[BranchNumber]) And Not IsNull(Me.[IncreaseOrDecrease]) And Not IsNull(Me.[Amount]) And Not IsNull(Me.[LoanOfficer]) And Not IsNull(Me.[LDDLogDateTimeCompleted]) Then
DoCmd.GoToRecord , , acNext
End If
End Sub
Basically, I'm trying to add a feature to my form that requires that if mandatory fields are not input, the form will not allow the user to "save" and proceed to the next record. Instead a message box will appear and require the user to input all the necessary information before the form can be "saved" and moved to the next record.
I hope my explanation wasn't confusing.
Thank you for your help.