Error msg on form with form closing (1 Viewer)

sandya

Registered User.
Local time
Today, 12:29
Joined
Oct 27, 2013
Messages
82
Hello Friends, Can anyone help for VBA code correction

I got an error msg on form with closing. I have a main form (SalesReturnOrDamaged) and subform (SalesReturnOrDamagedSubform).

i have used a VBA code on main form 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 change that VBA code for empty form close without save the record?

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


Thanks,
Sandhya.
 

Attachments

  • Error Screenshot.jpg
    Error Screenshot.jpg
    86.4 KB · Views: 82

Users who are viewing this thread

Top Bottom