If IsNull(Me.TransactionNameID) Or IsNull(Me.Credit) Or
Or IsNull(Me.Rate) Or IsNull(Me.EmployeeID) Then
If MsgBox("No value entered, do you want to continue exiting without saving?.", vbYesNo) = vbYes Then
Cancel = True
End If
End If
Good day to all! I'd like to ask for help regarding before update event and closing my form. first of all, the only exit button i have on this form is the command button i made earlier named cmdclose; and had a vba code attached to the on click event like this:
DoCmd.Close acForm, "frmReceivableT", acSaveNo
DoCmd.Requery ""
So at first i'm glad that the code itself works, it does not actually save the data when some of the needed data is not filled out yet. But, the problem lies to that when i press close and the messagebox appears, even if i choose "No" as an answer to the message box it still closes the form and as a result it appears to save the current incomplete data. But what i want is, if i press "No" i should be able to get back to the form and fill out the needed fields in order to pass from the validation rule i implemented earlier. Pressing "Yes" has no issue because it does exactly what i want it to do. Cancel saving data and closing the form. it's just that "No" that's causing me the problem. Any suggestions and opinions are welcome. Thanks in advance
Or IsNull(Me.Rate) Or IsNull(Me.EmployeeID) Then
If MsgBox("No value entered, do you want to continue exiting without saving?.", vbYesNo) = vbYes Then
Cancel = True
End If
End If
Good day to all! I'd like to ask for help regarding before update event and closing my form. first of all, the only exit button i have on this form is the command button i made earlier named cmdclose; and had a vba code attached to the on click event like this:
DoCmd.Close acForm, "frmReceivableT", acSaveNo
DoCmd.Requery ""
So at first i'm glad that the code itself works, it does not actually save the data when some of the needed data is not filled out yet. But, the problem lies to that when i press close and the messagebox appears, even if i choose "No" as an answer to the message box it still closes the form and as a result it appears to save the current incomplete data. But what i want is, if i press "No" i should be able to get back to the form and fill out the needed fields in order to pass from the validation rule i implemented earlier. Pressing "Yes" has no issue because it does exactly what i want it to do. Cancel saving data and closing the form. it's just that "No" that's causing me the problem. Any suggestions and opinions are welcome. Thanks in advance