PC Review


Reply
Thread Tools Rate Thread

Closing a form error 2585 This action cannot be carried out while processing a form or report event

 
 
SDLittle13@gmail.com
Guest
Posts: n/a
 
      9th Mar 2007
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.

 
Reply With Quote
 
 
 
 
Stefan Hoffmann
Guest
Posts: n/a
 
      10th Mar 2007
hi,

(E-Mail Removed) wrote:
> Closing a form error 2585 This action cannot be carried out while
> processing a form or report event.

Try a CancelEvent before closing your form.

> 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.CancleEvent
> DoCmd.Close acForm, "LINE ITEM POP-UP", acSaveNo
>
> End Sub


> Private Sub CancelButton_Enter()
> Call Line_Item_Wrap_Up
> End Sub

What do you like to achive with the enter event?


mfG
--> stefan <--
 
Reply With Quote
 
SDL
Guest
Posts: n/a
 
      10th Mar 2007
On the enter or click even I just want to close the pop up and return
to the form that opened it. I tried the cancelevent, but it did not
fix the problem I still get the same error.


 
Reply With Quote
 
Stefan Hoffmann
Guest
Posts: n/a
 
      11th Mar 2007
hi,

SDL wrote:
> On the enter or click even I just want to close the pop up and return
> to the form that opened it.
> I tried the cancelevent, but it did not fix the problem I still get the same error.

Just delete the on enter method of your button. I cannot imagine any
reason for calling Line_Item_Wrap_Up in it.

btw, you should use a better naming convention, e.g.:

--
Option Compare Database
Option Explicit

Private m_CalledLineItemPopUp As String

Private Sub LineItemWrapUp()

DoCmd.SetWarnings True

If m_CalledLineItemPopUp = "NEW INVOICE" Then
DoCmd.OpenForm "InvoiceNew"
Else
DoCmd.OpenForm "InvoceEdit"
End If
DoEvents
DoCmd.Close acForm, "LineItemPopUp", acSaveNo

End Sub

Private Sub cmdCancel_Click()

LineItemWrapUp

End Sub

Private Sub cmdCancel_Enter()

LineItemWrapUp

End Sub

Private Sub Form_Open(Cancel As Integer)

m_CalledLineItemPopUp = "NEW INVOICE"

End Sub
--

mfG
--> stefan <--
 
Reply With Quote
 
SDL
Guest
Posts: n/a
 
      11th Mar 2007
Dropping the enter proceeder did the trick. Thank you for the pointers
on the naming conventions I have programmed for years and tend to use
an older style, but I can see your point. Thank you for your help!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 2950: This action can't be carried out while processing ... Chris v. Microsoft Access Macros 4 3rd Mar 2009 09:12 AM
err 2585 - this action can't be carried out while processing a form or report event Jim Franklin Microsoft Access Form Coding 1 25th Sep 2008 02:23 PM
Close button on a form will not close form - error 2585 - action cannot be carried out while processing a form Angus Comber Microsoft Access 2 19th Jul 2006 12:21 PM
Error 2585 This Action cannot be carried out .... =?Utf-8?B?QnJvb2s=?= Microsoft Access Form Coding 1 22nd Apr 2005 02:54 PM
Error 2585 This Action cannot be carried out while processing a form or report David C. Widener Microsoft Access 1 30th Sep 2004 07:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:44 AM.