S
SDLittle13
Closing a form error 2585 This action cannot be carried out while
processing a form or report event.
This message is occurring in a pop-up I have created to add line items
to an invoice.
The form works fine if they create a line item and click the ITEM DONE
button which adds the item to a temporary table and then executes Call
Line_Item_Wrap_Up
This is the code executed which simply determines which module called
it, reopens that form, and closes the current form. This work fine
under normal circumstances.
Sub Line_Item_Wrap_Up()
DoCmd.SetWarnings True
If Public_CALLED_LINE_ITEM_POP_UP = "NEW INVOICE" Then
DoCmd.OpenForm "NEW INVOICE"
Else
DoCmd.OpenForm "EDIT INVOICE SHOWN"
End If
DoCmd.Close acForm, "LINE ITEM POP-UP", acSaveNo
End Sub
However, when I added a CANCEL BUTTON to allow them to simply go back
without adding a line item using the same paragraph to return control
I get the error. The code connected to this button is below. As you
can see it call the same wrap up paragraph as the code that adds the
line item, but for some reason it doesn't feel it can close the form.
Private Sub CancelButton_Enter()
Call Line_Item_Wrap_Up
End Sub
Private Sub CancelButton_Click()
Call Line_Item_Wrap_Up
End Sub
Any ideas here would be great. Thank you in advance for your help.
processing a form or report event.
This message is occurring in a pop-up I have created to add line items
to an invoice.
The form works fine if they create a line item and click the ITEM DONE
button which adds the item to a temporary table and then executes Call
Line_Item_Wrap_Up
This is the code executed which simply determines which module called
it, reopens that form, and closes the current form. This work fine
under normal circumstances.
Sub Line_Item_Wrap_Up()
DoCmd.SetWarnings True
If Public_CALLED_LINE_ITEM_POP_UP = "NEW INVOICE" Then
DoCmd.OpenForm "NEW INVOICE"
Else
DoCmd.OpenForm "EDIT INVOICE SHOWN"
End If
DoCmd.Close acForm, "LINE ITEM POP-UP", acSaveNo
End Sub
However, when I added a CANCEL BUTTON to allow them to simply go back
without adding a line item using the same paragraph to return control
I get the error. The code connected to this button is below. As you
can see it call the same wrap up paragraph as the code that adds the
line item, but for some reason it doesn't feel it can close the form.
Private Sub CancelButton_Enter()
Call Line_Item_Wrap_Up
End Sub
Private Sub CancelButton_Click()
Call Line_Item_Wrap_Up
End Sub
Any ideas here would be great. Thank you in advance for your help.