Hi, to everyone. I have the following issue. I have a form with a subform and a save button. When i press the button it looks for a duplicate and if there is no duplicate it show a msgbox asking if i want to add or no the new record. if i press yes it save the data into the table. If i press NO it also saved the data into the table. So what i want is that when i press no that it stop and not perform the cmdsaverecord. Here is the code i have
Code:
Private Sub cmdSaveRecord_Click()Dim response As Integer
If IsNull(Me.HS_Parts) _
Or IsNull(Me.frmAdd_UTC_PartNumber_Vendor_Subform.Controls(ID)) Then
MsgBox "HS PART OR VENDOR INFORMATION ID IS EMPTY,THOSE FIELDS ARE REQUIRED", vbCritical
Else
response = MsgBox("Do you really wants to add this record? ", vbYesNo + vbQuestion, "Add Record")
If response = vbYes Then
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Not Added"
Else
MsgBox "Record not Added", vbCritical
End If
End If
I don't know what else to do. Even i deleted the docmd.runcommand acCmdSaveRecord and it still saving the data into the table. help plz