Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Previous Operation was cancelled' error when filtering form

Status
Not open for further replies.

leanne123

Technical User
Jun 6, 2008
18
US
I have a form and a combobox that filters the form. This works for the date field. Now I am adding exact same code to the change event of 2 more combo boxes and they do not work?

thread702-1384539 addresses similar issue.
BEGIN CODE
Private Sub cboStatus_Change()
Me.Filter = "IDOCStatus = '" & Me.cboStatus & "'"
Me.FilterOn = True
End Sub
END CODE

What is the problem? Is it corrupted? If so how do I de-compile my code?
 
I do not do this often, but Looking at the original thread I first say I disagree with Ace Man
is typical of what you'd get if you cancelled a method, like setting the Cancel arguement to true in the On Open event of a form or report. It just doesn't jive with DLookup which is causing the confusion.

Although the first part of his statement is correct the second part about it not jiving with a dlookup is incorrect. This is a well known bug that Access gives you an eroneous "you canceled..." error when it has nothing to do with canceling an event. This happens in a dlookup when you misspell field, tables, or criteria. You can Google and pull up a lot of discussion on that issue.
My guess is that like the dlookup the filter criteria will throw this erroneous. I might be wrong.

1)put in a
Me.Filter = "IDOCStatus = '" & Me.cboStatus & "'"
debug.print me.filter

and check that the filter string is what you expect.

2) ensure that the status is not numeric which would require no single quotations.
 
Put the following line as the first instruction in your Change event procedure:
Me.FilterOn = False

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
MajP - thanks so much. My problem was that stored values on the form were numeric, for example the status 'pending' or 'cleared' are comboboxes themselves and are numeric due to the ID being the first invisible column. I was trying to set the filter to the actual text instead of the ID.

PHV - also added your line for sake of good order.

Thanks so much for the assistance!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top