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!frmBemExceptions!bemDescription OR ISNULL(Forms!frmBemExceptions!bemDescription)) And ((BEM_EXCEPTIONS.BEM_GROUP_ID)=Forms!frmBemExceptions!bemQueue Or ISNULL(Forms!frmBemExceptions!bemQueue)) And ((BEM_EXCEPTIONS.BEM_PRIORITY)=Forms!frmBemExceptions!bemPriority Or ISNULL(Forms!frmBemExceptions!bemPriority)) And ((BEM_EXCEPTIONS.BEM_STATUS)=Forms!frmBemExceptions!bemStatus Or ISNULL(Forms!frmBemExceptions!bemStatus)) And ((BEM_EXCEPTIONS.BEM_ENTITY)=Forms!frmBemExceptions!bemEntity Or ISNULL(Forms!frmBemExceptions!bemEntity)) And ((BEM_EXCEPTIONS.BEM_CPTY_ID)=Forms!frmBemExceptions!bemCptyID Or ISNULL(Forms!frmBemExceptions!bemCptyID)) And ((BEM_EXCEPTIONS.BEM_CPTY_TYPE)=Forms!frmBemExceptions!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)));
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!frmBemExceptions!bemDescription OR ISNULL(Forms!frmBemExceptions!bemDescription)) And ((BEM_EXCEPTIONS.BEM_GROUP_ID)=Forms!frmBemExceptions!bemQueue Or ISNULL(Forms!frmBemExceptions!bemQueue)) And ((BEM_EXCEPTIONS.BEM_PRIORITY)=Forms!frmBemExceptions!bemPriority Or ISNULL(Forms!frmBemExceptions!bemPriority)) And ((BEM_EXCEPTIONS.BEM_STATUS)=Forms!frmBemExceptions!bemStatus Or ISNULL(Forms!frmBemExceptions!bemStatus)) And ((BEM_EXCEPTIONS.BEM_ENTITY)=Forms!frmBemExceptions!bemEntity Or ISNULL(Forms!frmBemExceptions!bemEntity)) And ((BEM_EXCEPTIONS.BEM_CPTY_ID)=Forms!frmBemExceptions!bemCptyID Or ISNULL(Forms!frmBemExceptions!bemCptyID)) And ((BEM_EXCEPTIONS.BEM_CPTY_TYPE)=Forms!frmBemExceptions!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)));