Filtering Error: "You Cancelled the Previous Operation"

I have a form that I've developed that shows data from all over my database, 
grouping it all together and displaying it for the user's ease of use.  There 
are four status indicator columns on this form, each one either equal to 
"Green", "Yellow", or "Red".  At the bottom of each column is a drop-down 
combo box I have added that allows the user to filter on a certain color, so 
they can see what records have a certain status.  They can search on "Green", 
"Yellow", "Red", or "All", which removes all filtering.  

Three of the four comboboxes work perfectly, but the fourth throws the 
following error no matter what I click:

Run-Time Error '2001': You cancelled the previous operation.

The code for the combobox is almost identical to the others, the only 
difference being the names of the comboboxes and the filtered fields:

    cboForecastScheduleCol = "All"
    cboForecastCostCol = "All"
    cboOverallStatCol = "All"
        
    If cboCostToDateCol.Column(0) = "Green" Then
        Me.Filter = "IND_CTD = 'Green'"
        Me.FilterOn = True
        Me.Requery
        
        Me.txtFiltered.Visible = True
    ElseIf (cboCostToDateCol.Column(0)) = "Yellow" Then
        Me.Filter = "IND_CTD = 'Yellow'"
        Me.FilterOn = True
        Me.Requery
        
        Me.txtFiltered.Visible = True
    ElseIf (cboCostToDateCol.Column(0)) = "Red" Then
        Me.Filter = "IND_CTD = 'Red'"
        Me.FilterOn = True
        Me.Requery
        
        Me.txtFiltered.Visible = True
    ElseIf (cboCostToDateCol.Column(0)) = "All" Then
        Me.Filter = ""
        Me.FilterOn = False
        Me.Requery
        
        Me.txtFiltered.Visible = False
    End If

I have tried setting me.dirty  = False, I've tried using docmd.save to save 
the record, nothing.  The code is the exact same as works perfectly on three 
other controls of the same time on the same form.  What could possibly be 
wrong?

Thanks,

Dustin
0
Utf
2/19/2007 7:22:39 PM
access.formscoding 7493 articles. 0 followers. Follow

5 Replies
847 Views

Similar Articles

[PageSpeed] 25

Hello Dustin,

I run into that error a lot.  I just trap it, something like this:

err_Section:

If err = 2001 then
    Resume Next
Else
    "Error " & err & ":" & err.description
    resume next
End If


God Bless,

Mark A. Sam


"Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message 
news:473335A7-108D-4DEA-8525-2B740087735B@microsoft.com...
>I have a form that I've developed that shows data from all over my 
>database,
> grouping it all together and displaying it for the user's ease of use. 
> There
> are four status indicator columns on this form, each one either equal to
> "Green", "Yellow", or "Red".  At the bottom of each column is a drop-down
> combo box I have added that allows the user to filter on a certain color, 
> so
> they can see what records have a certain status.  They can search on 
> "Green",
> "Yellow", "Red", or "All", which removes all filtering.
>
> Three of the four comboboxes work perfectly, but the fourth throws the
> following error no matter what I click:
>
> Run-Time Error '2001': You cancelled the previous operation.
>
> The code for the combobox is almost identical to the others, the only
> difference being the names of the comboboxes and the filtered fields:
>
>    cboForecastScheduleCol = "All"
>    cboForecastCostCol = "All"
>    cboOverallStatCol = "All"
>
>    If cboCostToDateCol.Column(0) = "Green" Then
>        Me.Filter = "IND_CTD = 'Green'"
>        Me.FilterOn = True
>        Me.Requery
>
>        Me.txtFiltered.Visible = True
>    ElseIf (cboCostToDateCol.Column(0)) = "Yellow" Then
>        Me.Filter = "IND_CTD = 'Yellow'"
>        Me.FilterOn = True
>        Me.Requery
>
>        Me.txtFiltered.Visible = True
>    ElseIf (cboCostToDateCol.Column(0)) = "Red" Then
>        Me.Filter = "IND_CTD = 'Red'"
>        Me.FilterOn = True
>        Me.Requery
>
>        Me.txtFiltered.Visible = True
>    ElseIf (cboCostToDateCol.Column(0)) = "All" Then
>        Me.Filter = ""
>        Me.FilterOn = False
>        Me.Requery
>
>        Me.txtFiltered.Visible = False
>    End If
>
> I have tried setting me.dirty  = False, I've tried using docmd.save to 
> save
> the record, nothing.  The code is the exact same as works perfectly on 
> three
> other controls of the same time on the same form.  What could possibly be
> wrong?
>
> Thanks,
>
> Dustin 


0
Mark
2/19/2007 7:35:17 PM
Well, that code makes it so the error doesn't come up, but this also causes 
it not to apply the filter.  Since this error comes up every time I try to 
filter using that combobox, it kinda means that combobox doesn't work at all.

Is there anything more to it?

Thanks,

Dustin

"Mark A. Sam" wrote:

> Hello Dustin,
> 
> I run into that error a lot.  I just trap it, something like this:
> 
> err_Section:
> 
> If err = 2001 then
>     Resume Next
> Else
>     "Error " & err & ":" & err.description
>     resume next
> End If
> 
> 
> God Bless,
> 
> Mark A. Sam
> 
> 
> "Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message 
> news:473335A7-108D-4DEA-8525-2B740087735B@microsoft.com...
> >I have a form that I've developed that shows data from all over my 
> >database,
> > grouping it all together and displaying it for the user's ease of use. 
> > There
> > are four status indicator columns on this form, each one either equal to
> > "Green", "Yellow", or "Red".  At the bottom of each column is a drop-down
> > combo box I have added that allows the user to filter on a certain color, 
> > so
> > they can see what records have a certain status.  They can search on 
> > "Green",
> > "Yellow", "Red", or "All", which removes all filtering.
> >
> > Three of the four comboboxes work perfectly, but the fourth throws the
> > following error no matter what I click:
> >
> > Run-Time Error '2001': You cancelled the previous operation.
> >
> > The code for the combobox is almost identical to the others, the only
> > difference being the names of the comboboxes and the filtered fields:
> >
> >    cboForecastScheduleCol = "All"
> >    cboForecastCostCol = "All"
> >    cboOverallStatCol = "All"
> >
> >    If cboCostToDateCol.Column(0) = "Green" Then
> >        Me.Filter = "IND_CTD = 'Green'"
> >        Me.FilterOn = True
> >        Me.Requery
> >
> >        Me.txtFiltered.Visible = True
> >    ElseIf (cboCostToDateCol.Column(0)) = "Yellow" Then
> >        Me.Filter = "IND_CTD = 'Yellow'"
> >        Me.FilterOn = True
> >        Me.Requery
> >
> >        Me.txtFiltered.Visible = True
> >    ElseIf (cboCostToDateCol.Column(0)) = "Red" Then
> >        Me.Filter = "IND_CTD = 'Red'"
> >        Me.FilterOn = True
> >        Me.Requery
> >
> >        Me.txtFiltered.Visible = True
> >    ElseIf (cboCostToDateCol.Column(0)) = "All" Then
> >        Me.Filter = ""
> >        Me.FilterOn = False
> >        Me.Requery
> >
> >        Me.txtFiltered.Visible = False
> >    End If
> >
> > I have tried setting me.dirty  = False, I've tried using docmd.save to 
> > save
> > the record, nothing.  The code is the exact same as works perfectly on 
> > three
> > other controls of the same time on the same form.  What could possibly be
> > wrong?
> >
> > Thanks,
> >
> > Dustin 
> 
> 
> 
0
Utf
2/19/2007 8:29:00 PM
Sorry, I didn't notice that that filtering wasn't working. Just as a long 
shot, try removing the Me.Requery lines. Also you could try stepping through 
the code to see where the error occurs.

"Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message 
news:FD150058-36BD-446E-87D1-7474D88FCC91@microsoft.com...
> Well, that code makes it so the error doesn't come up, but this also 
> causes
> it not to apply the filter.  Since this error comes up every time I try to
> filter using that combobox, it kinda means that combobox doesn't work at 
> all.
>
> Is there anything more to it?
>
> Thanks,
>
> Dustin
>
> "Mark A. Sam" wrote:
>
>> Hello Dustin,
>>
>> I run into that error a lot.  I just trap it, something like this:
>>
>> err_Section:
>>
>> If err = 2001 then
>>     Resume Next
>> Else
>>     "Error " & err & ":" & err.description
>>     resume next
>> End If
>>
>>
>> God Bless,
>>
>> Mark A. Sam
>>
>>
>> "Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message
>> news:473335A7-108D-4DEA-8525-2B740087735B@microsoft.com...
>> >I have a form that I've developed that shows data from all over my
>> >database,
>> > grouping it all together and displaying it for the user's ease of use.
>> > There
>> > are four status indicator columns on this form, each one either equal 
>> > to
>> > "Green", "Yellow", or "Red".  At the bottom of each column is a 
>> > drop-down
>> > combo box I have added that allows the user to filter on a certain 
>> > color,
>> > so
>> > they can see what records have a certain status.  They can search on
>> > "Green",
>> > "Yellow", "Red", or "All", which removes all filtering.
>> >
>> > Three of the four comboboxes work perfectly, but the fourth throws the
>> > following error no matter what I click:
>> >
>> > Run-Time Error '2001': You cancelled the previous operation.
>> >
>> > The code for the combobox is almost identical to the others, the only
>> > difference being the names of the comboboxes and the filtered fields:
>> >
>> >    cboForecastScheduleCol = "All"
>> >    cboForecastCostCol = "All"
>> >    cboOverallStatCol = "All"
>> >
>> >    If cboCostToDateCol.Column(0) = "Green" Then
>> >        Me.Filter = "IND_CTD = 'Green'"
>> >        Me.FilterOn = True
>> >        Me.Requery
>> >
>> >        Me.txtFiltered.Visible = True
>> >    ElseIf (cboCostToDateCol.Column(0)) = "Yellow" Then
>> >        Me.Filter = "IND_CTD = 'Yellow'"
>> >        Me.FilterOn = True
>> >        Me.Requery
>> >
>> >        Me.txtFiltered.Visible = True
>> >    ElseIf (cboCostToDateCol.Column(0)) = "Red" Then
>> >        Me.Filter = "IND_CTD = 'Red'"
>> >        Me.FilterOn = True
>> >        Me.Requery
>> >
>> >        Me.txtFiltered.Visible = True
>> >    ElseIf (cboCostToDateCol.Column(0)) = "All" Then
>> >        Me.Filter = ""
>> >        Me.FilterOn = False
>> >        Me.Requery
>> >
>> >        Me.txtFiltered.Visible = False
>> >    End If
>> >
>> > I have tried setting me.dirty  = False, I've tried using docmd.save to
>> > save
>> > the record, nothing.  The code is the exact same as works perfectly on
>> > three
>> > other controls of the same time on the same form.  What could possibly 
>> > be
>> > wrong?
>> >
>> > Thanks,
>> >
>> > Dustin
>>
>>
>> 


0
Mark
2/19/2007 8:56:05 PM
I'm sorry, I guess I forgot that little detail.  The error is occuring at the 
following lines:

Me.Filter = "IND_CTD = 'Green'"
Me.FilterOn = True

(Or at the line where it sets the filter to 'Yellow' or 'Red', depending on 
which one I click on.)  Sometimes it occurs on the Me.FilterOn = True line, 
but this is far less common.

Dustin

"Mark A. Sam" wrote:

> Sorry, I didn't notice that that filtering wasn't working. Just as a long 
> shot, try removing the Me.Requery lines. Also you could try stepping through 
> the code to see where the error occurs.
> 
> "Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message 
> news:FD150058-36BD-446E-87D1-7474D88FCC91@microsoft.com...
> > Well, that code makes it so the error doesn't come up, but this also 
> > causes
> > it not to apply the filter.  Since this error comes up every time I try to
> > filter using that combobox, it kinda means that combobox doesn't work at 
> > all.
> >
> > Is there anything more to it?
> >
> > Thanks,
> >
> > Dustin
> >
> > "Mark A. Sam" wrote:
> >
> >> Hello Dustin,
> >>
> >> I run into that error a lot.  I just trap it, something like this:
> >>
> >> err_Section:
> >>
> >> If err = 2001 then
> >>     Resume Next
> >> Else
> >>     "Error " & err & ":" & err.description
> >>     resume next
> >> End If
> >>
> >>
> >> God Bless,
> >>
> >> Mark A. Sam
> >>
> >>
> >> "Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message
> >> news:473335A7-108D-4DEA-8525-2B740087735B@microsoft.com...
> >> >I have a form that I've developed that shows data from all over my
> >> >database,
> >> > grouping it all together and displaying it for the user's ease of use.
> >> > There
> >> > are four status indicator columns on this form, each one either equal 
> >> > to
> >> > "Green", "Yellow", or "Red".  At the bottom of each column is a 
> >> > drop-down
> >> > combo box I have added that allows the user to filter on a certain 
> >> > color,
> >> > so
> >> > they can see what records have a certain status.  They can search on
> >> > "Green",
> >> > "Yellow", "Red", or "All", which removes all filtering.
> >> >
> >> > Three of the four comboboxes work perfectly, but the fourth throws the
> >> > following error no matter what I click:
> >> >
> >> > Run-Time Error '2001': You cancelled the previous operation.
> >> >
> >> > The code for the combobox is almost identical to the others, the only
> >> > difference being the names of the comboboxes and the filtered fields:
> >> >
> >> >    cboForecastScheduleCol = "All"
> >> >    cboForecastCostCol = "All"
> >> >    cboOverallStatCol = "All"
> >> >
> >> >    If cboCostToDateCol.Column(0) = "Green" Then
> >> >        Me.Filter = "IND_CTD = 'Green'"
> >> >        Me.FilterOn = True
> >> >        Me.Requery
> >> >
> >> >        Me.txtFiltered.Visible = True
> >> >    ElseIf (cboCostToDateCol.Column(0)) = "Yellow" Then
> >> >        Me.Filter = "IND_CTD = 'Yellow'"
> >> >        Me.FilterOn = True
> >> >        Me.Requery
> >> >
> >> >        Me.txtFiltered.Visible = True
> >> >    ElseIf (cboCostToDateCol.Column(0)) = "Red" Then
> >> >        Me.Filter = "IND_CTD = 'Red'"
> >> >        Me.FilterOn = True
> >> >        Me.Requery
> >> >
> >> >        Me.txtFiltered.Visible = True
> >> >    ElseIf (cboCostToDateCol.Column(0)) = "All" Then
> >> >        Me.Filter = ""
> >> >        Me.FilterOn = False
> >> >        Me.Requery
> >> >
> >> >        Me.txtFiltered.Visible = False
> >> >    End If
> >> >
> >> > I have tried setting me.dirty  = False, I've tried using docmd.save to
> >> > save
> >> > the record, nothing.  The code is the exact same as works perfectly on
> >> > three
> >> > other controls of the same time on the same form.  What could possibly 
> >> > be
> >> > wrong?
> >> >
> >> > Thanks,
> >> >
> >> > Dustin
> >>
> >>
> >> 
> 
> 
> 
0
Utf
2/19/2007 9:13:10 PM
You didn't forget to mention it, I forgot to read it. ;)

Whenever I get these type of problems, I just play around until I get a 
solution.  Is your db small (like under 2 mb)  where you can email it to me?

If you want to send it to me use:

msam
AT
Promote
dot
Org

God Bless,

Mark


"Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message 
news:5E82F9C2-7B4B-4842-85C4-110379F29D50@microsoft.com...
> I'm sorry, I guess I forgot that little detail.  The error is occuring at 
> the
> following lines:
>
> Me.Filter = "IND_CTD = 'Green'"
> Me.FilterOn = True
>
> (Or at the line where it sets the filter to 'Yellow' or 'Red', depending 
> on
> which one I click on.)  Sometimes it occurs on the Me.FilterOn = True 
> line,
> but this is far less common.
>
> Dustin
>
> "Mark A. Sam" wrote:
>
>> Sorry, I didn't notice that that filtering wasn't working. Just as a long
>> shot, try removing the Me.Requery lines. Also you could try stepping 
>> through
>> the code to see where the error occurs.
>>
>> "Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message
>> news:FD150058-36BD-446E-87D1-7474D88FCC91@microsoft.com...
>> > Well, that code makes it so the error doesn't come up, but this also
>> > causes
>> > it not to apply the filter.  Since this error comes up every time I try 
>> > to
>> > filter using that combobox, it kinda means that combobox doesn't work 
>> > at
>> > all.
>> >
>> > Is there anything more to it?
>> >
>> > Thanks,
>> >
>> > Dustin
>> >
>> > "Mark A. Sam" wrote:
>> >
>> >> Hello Dustin,
>> >>
>> >> I run into that error a lot.  I just trap it, something like this:
>> >>
>> >> err_Section:
>> >>
>> >> If err = 2001 then
>> >>     Resume Next
>> >> Else
>> >>     "Error " & err & ":" & err.description
>> >>     resume next
>> >> End If
>> >>
>> >>
>> >> God Bless,
>> >>
>> >> Mark A. Sam
>> >>
>> >>
>> >> "Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in 
>> >> message
>> >> news:473335A7-108D-4DEA-8525-2B740087735B@microsoft.com...
>> >> >I have a form that I've developed that shows data from all over my
>> >> >database,
>> >> > grouping it all together and displaying it for the user's ease of 
>> >> > use.
>> >> > There
>> >> > are four status indicator columns on this form, each one either 
>> >> > equal
>> >> > to
>> >> > "Green", "Yellow", or "Red".  At the bottom of each column is a
>> >> > drop-down
>> >> > combo box I have added that allows the user to filter on a certain
>> >> > color,
>> >> > so
>> >> > they can see what records have a certain status.  They can search on
>> >> > "Green",
>> >> > "Yellow", "Red", or "All", which removes all filtering.
>> >> >
>> >> > Three of the four comboboxes work perfectly, but the fourth throws 
>> >> > the
>> >> > following error no matter what I click:
>> >> >
>> >> > Run-Time Error '2001': You cancelled the previous operation.
>> >> >
>> >> > The code for the combobox is almost identical to the others, the 
>> >> > only
>> >> > difference being the names of the comboboxes and the filtered 
>> >> > fields:
>> >> >
>> >> >    cboForecastScheduleCol = "All"
>> >> >    cboForecastCostCol = "All"
>> >> >    cboOverallStatCol = "All"
>> >> >
>> >> >    If cboCostToDateCol.Column(0) = "Green" Then
>> >> >        Me.Filter = "IND_CTD = 'Green'"
>> >> >        Me.FilterOn = True
>> >> >        Me.Requery
>> >> >
>> >> >        Me.txtFiltered.Visible = True
>> >> >    ElseIf (cboCostToDateCol.Column(0)) = "Yellow" Then
>> >> >        Me.Filter = "IND_CTD = 'Yellow'"
>> >> >        Me.FilterOn = True
>> >> >        Me.Requery
>> >> >
>> >> >        Me.txtFiltered.Visible = True
>> >> >    ElseIf (cboCostToDateCol.Column(0)) = "Red" Then
>> >> >        Me.Filter = "IND_CTD = 'Red'"
>> >> >        Me.FilterOn = True
>> >> >        Me.Requery
>> >> >
>> >> >        Me.txtFiltered.Visible = True
>> >> >    ElseIf (cboCostToDateCol.Column(0)) = "All" Then
>> >> >        Me.Filter = ""
>> >> >        Me.FilterOn = False
>> >> >        Me.Requery
>> >> >
>> >> >        Me.txtFiltered.Visible = False
>> >> >    End If
>> >> >
>> >> > I have tried setting me.dirty  = False, I've tried using docmd.save 
>> >> > to
>> >> > save
>> >> > the record, nothing.  The code is the exact same as works perfectly 
>> >> > on
>> >> > three
>> >> > other controls of the same time on the same form.  What could 
>> >> > possibly
>> >> > be
>> >> > wrong?
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Dustin
>> >>
>> >>
>> >>
>>
>>
>> 


0
Mark
2/19/2007 9:57:57 PM
Reply:

Similar Artilces:

Run time error '2001' You cancelled the previous operation
Hi, My data entry form was working just fine until I loaded the production data. Now I am getting the above error I cannot figure out why this is happening. The error is happening in the following code: Private Sub cboPlants_AfterUpdate() 'On Error GoTo Err_cboPlants_AfterUpdate Dim strPlants As String Dim strYear As String Dim TheDate As Date Dim strKey As Integer 'Code added If IsNull(cboPlants) Then Exit Sub End If If IsNull(Me!cboSource1) Then MsgBox ("Please select the Source") Me!cboSource1.SetFocus Else TheDate = Now() strPlants = Me!txtP...

Filtering Error: "You Cancelled the Previous Operation"
I have a form that I've developed that shows data from all over my database, grouping it all together and displaying it for the user's ease of use. There are four status indicator columns on this form, each one either equal to "Green", "Yellow", or "Red". At the bottom of each column is a drop-down combo box I have added that allows the user to filter on a certain color, so they can see what records have a certain status. They can search on "Green", "Yellow", "Red", or "All", which removes all filtering. ...