Hello friends, Can any one help on my issue
I got an error msg on form with closing. I have a main form (SalesReturnOrD amaged) and subform (SalesReturnOrD amagedSubform).
So if empty form close then i need to without save the record. So in this case i have used a VBA code on Close Command button as per shown in Code Tag. But that is not working and shown an error msg as per screenshot. Can you please replay how to give a VBA code for empty form close without save the record?
I have attached the dB and screen shot with explanation.
I got an error msg on form with closing. I have a main form (SalesReturnOrD amaged) and subform (SalesReturnOrD amagedSubform).
So if empty form close then i need to without save the record. So in this case i have used a VBA code on Close Command button as per shown in Code Tag. But that is not working and shown an error msg as per screenshot. Can you please replay how to give a VBA code for empty form close without save the record?
I have attached the dB and screen shot with explanation.
Code:
Private Sub Close_Click()
On Error GoTo Err_Close_Click
If Forms![SalesReturnOrDamaged]![SalesReturnOrDamagedSubform].Form![ItemCode].Value = "" Then
Forms![SalesReturnOrDamaged]![SalesReturnOrDamagedSubform].Form![Product].Value = ""
Forms![SalesReturnOrDamaged]![SalesReturnOrDamagedSubform].Form![MRP].Value = 0 Or ""
Forms![SalesReturnOrDamaged]![SalesReturnOrDamagedSubform].Form![Qty].Value = 0 Or ""
Beep
If MsgBox("Do you want to delete this Return Record? Because Subform Product details are not updated properly.", vbYesNo, "Delete Confirmation") = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
Else
GoTo Exit_Close_Click
End If
End If
DoCmd.Close
Exit_Close_Click:
Exit Sub
Err_Close_Click:
MsgBox Err.Description
Resume Exit_Close_Click
End Sub
Comment