View Full Version : Run Time Error 2001 - What am I doing wrong?


zeee
01-06-2005, 07:52 AM
I have a simple form with a reset, a submit query and a close button. If I click the reset button and then try to run a qery I get an error message that says 'Run Time Error '2001': you canceled the last operation'. What does this mean and how can I get rid of it?. Here is my code....

Private Sub CloseButton_Click()
DoCmd.Close
End Sub

Private Sub ResetButton_Click()
[bemDescription] = ""
[bemQueue] = ""
[bemPriority] = ""
[bemStatus] = ""
[bemEntity] = ""
[bemCptyID] = ""
[bemCptyType] = ""
[bemValueDateFrom] = ""
[bemValueDateTo] = ""
[bemCreationDateFrom] = ""
[bemCreationDateTo] = ""

End Sub

Private Sub QueryButton_Click()
Me.Visible = False
DoCmd.OpenQuery "bemExceptionsQuery", acViewNormal, acReadOnly
End Sub

This is the sql query:

SELECT *
FROM BEM_EXCEPTIONS
WHERE (((BEM_EXCEPTIONS.BEM_EXCEPTION_DESC)=Forms!frmBem Exceptions!bemDescription OR ISNULL(Forms!frmBemExceptions!bemDescription)) And ((BEM_EXCEPTIONS.BEM_GROUP_ID)=Forms!frmBemExcepti ons!bemQueue Or ISNULL(Forms!frmBemExceptions!bemQueue)) And ((BEM_EXCEPTIONS.BEM_PRIORITY)=Forms!frmBemExcepti ons!bemPriority Or ISNULL(Forms!frmBemExceptions!bemPriority)) And ((BEM_EXCEPTIONS.BEM_STATUS)=Forms!frmBemException s!bemStatus Or ISNULL(Forms!frmBemExceptions!bemStatus)) And ((BEM_EXCEPTIONS.BEM_ENTITY)=Forms!frmBemException s!bemEntity Or ISNULL(Forms!frmBemExceptions!bemEntity)) And ((BEM_EXCEPTIONS.BEM_CPTY_ID)=Forms!frmBemExceptio ns!bemCptyID Or ISNULL(Forms!frmBemExceptions!bemCptyID)) And ((BEM_EXCEPTIONS.BEM_CPTY_TYPE)=Forms!frmBemExcept ions!bemCptyType Or ISNULL(Forms!frmBemExceptions!bemCptyType)) And ((BEM_EXCEPTIONS.BEM_VALUE_DATE) Between Forms!frmBemExceptions!bemValueDateFrom And Forms!frmBemExceptions!bemValueDateTo Or ISNULL(Forms!frmBemExceptions!bemValueDateFrom)) And ((BEM_EXCEPTIONS.BEM_DATE_TIME_CREATION) Between Forms!frmBemExceptions!bemCreationDateFrom And Forms!frmBemExceptions!bemCreationDateTo Or ISNULL(Forms!frmBemExceptions!bemCreationDateFrom) ));