Hi There
This is the first time ever posting a question on a forum, so wish me luck.
Iam on the finishing touches of an access database and am running into an issue regarding a close button on my form. The code is meant to check the from for null criteria and if there is a null field, then give message and return user to form to complete missing information. Otherwise save and close form.
Here it is:
Private Sub TTL_Exit_Click()
On Error GoTo TTL_Exit_Err
If (IsNull([Invoice Complete Date])) Then
Beep
MsgBox "Incomplete Form: Invoice COMPLETE DATE Information Missing", vbExclamation, "Incomplete Form: Invoice Complete Date Information Missing"
DoCmd.CancelEvent
ElseIf (IsNull([Invoice #])) Then
Beep
MsgBox "Incomplete Form: INVOICE # Information Missing", vbExclamation, "Incomplete Form: Invoice # Missing"
DoCmd.CancelEvent
ElseIf (IsNull(Depth)) Then
Beep
MsgBox "Incomplete Form: DEPTH Information Missing", vbExclamation, "Incomplete Form: Depth Missing"
DoCmd.CancelEvent
ElseIf (IsNull([Final Total])) Then
Beep
MsgBox "Incomplete Form: FINAL TOTAL Information Missing", vbExclamation, "Incomplete Form: Final Total Missing Information"
DoCmd.CancelEvent
ElseIf (IsNull([Billable Total])) Then
Beep
MsgBox "Incomplete Form: BILLABLE TOTAL Information Missing", vbExclamation, "Incomplete Form: Billable Total Information Missing"
DoCmd.CancelEvent
End If
DoCmd.Close
TTL_Exit_Exit:
Exit Sub
TTL_Exit_Err:
MsgBox Error$
Resume TTL_Exit_Exit
End Sub
The issue is that if there is a blank field, it will recognize that and warn me, but will continue to close the form instead of cancelling the event and returning the user back to the form to fill in missing information.
Thank you for your help in advance and any advice would be appreciated.
T
This is the first time ever posting a question on a forum, so wish me luck.
Iam on the finishing touches of an access database and am running into an issue regarding a close button on my form. The code is meant to check the from for null criteria and if there is a null field, then give message and return user to form to complete missing information. Otherwise save and close form.
Here it is:
Private Sub TTL_Exit_Click()
On Error GoTo TTL_Exit_Err
If (IsNull([Invoice Complete Date])) Then
Beep
MsgBox "Incomplete Form: Invoice COMPLETE DATE Information Missing", vbExclamation, "Incomplete Form: Invoice Complete Date Information Missing"
DoCmd.CancelEvent
ElseIf (IsNull([Invoice #])) Then
Beep
MsgBox "Incomplete Form: INVOICE # Information Missing", vbExclamation, "Incomplete Form: Invoice # Missing"
DoCmd.CancelEvent
ElseIf (IsNull(Depth)) Then
Beep
MsgBox "Incomplete Form: DEPTH Information Missing", vbExclamation, "Incomplete Form: Depth Missing"
DoCmd.CancelEvent
ElseIf (IsNull([Final Total])) Then
Beep
MsgBox "Incomplete Form: FINAL TOTAL Information Missing", vbExclamation, "Incomplete Form: Final Total Missing Information"
DoCmd.CancelEvent
ElseIf (IsNull([Billable Total])) Then
Beep
MsgBox "Incomplete Form: BILLABLE TOTAL Information Missing", vbExclamation, "Incomplete Form: Billable Total Information Missing"
DoCmd.CancelEvent
End If
DoCmd.Close
TTL_Exit_Exit:
Exit Sub
TTL_Exit_Err:
MsgBox Error$
Resume TTL_Exit_Exit
End Sub
The issue is that if there is a blank field, it will recognize that and warn me, but will continue to close the form instead of cancelling the event and returning the user back to the form to fill in missing information.
Thank you for your help in advance and any advice would be appreciated.
T