Operation Canceled On Filter

  • Thread starter Thread starter Chaster
  • Start date Start date
C

Chaster

I don't understand why I am getting the "You canceled the previous operation
in the code below.

Any help would be appreciated.

If Me.Text0 = 4 Then
Dim FindingWhat As Integer
FindingWhat = FindWhat 'The input box text value on my form. In this
instance 26700'
Forms![ate order for specific customer].Filter = "[all ate orders for
specific customer].CheckNum =" & FindingWhat
'Stops on above line with "You canceled the previous operation" error
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
End If

Thanks in advance.
 
Allen,
Thanks for your response but I am still getting the same you cancelled the
previous operation with your code. There is code before the if me.text0 = 4
line so I am enclosing it and ask that you look at it to see if there is
something in that code that may be causing this problem.
Thanks again

Private Sub FindWhat_AfterUpdate()
If Me.Text0 = 1 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl 'AciveControl = FindWhat
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 2 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "ATERefNum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 3 Then ' This code gives same problem as 4
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

Dim frm As Form
Dim strFilter As String
If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then
frm.Dirty = flase
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter 'Getting same you canceled the previous operation
error here
frm.FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

goout:
Set frm = Nothing

End Sub

Allen Browne said:
Don't include the form name in the Filter string.

Access will not be able to apply the filter if the form is dirty with a
record that can't be saved (e.g. validation rule not met).

Dim frm As Form
Dim strFilter As String

If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then 'Save any changes
frm.Dirty = False
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter
frm.FilterOn = True
'show/hide your controls here.
End If
Set frm = Nothing


The data type of the CheckNum field must be the same as the value you are
trying to set it to, and must have the corrrect delimiters. If CheckNum is a
Number field, then FindWhat must be a number (not a word or a Null). If
CheckNum is a Text type field, you need quote marks around the value to
find, i.e.:
strFilter = "CheckNum = """ & Me.FindWhat & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
I don't understand why I am getting the "You canceled the previous operation
in the code below.

Any help would be appreciated.

If Me.Text0 = 4 Then
Dim FindingWhat As Integer
FindingWhat = FindWhat 'The input box text value on my form. In this
instance 26700'
Forms![ate order for specific customer].Filter = "[all ate orders for
specific customer].CheckNum =" & FindingWhat
'Stops on above line with "You canceled the previous operation" error
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
End If
 
What is the data type of the invnum field in your table?
What is the data type of the ATERefNum field in your table?
What is the data type of the CheckNum field in your table?
Is text0 bound to a field?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")
Chaster said:
Allen,
Thanks for your response but I am still getting the same you cancelled the
previous operation with your code. There is code before the if me.text0 = 4
line so I am enclosing it and ask that you look at it to see if there is
something in that code that may be causing this problem.
Thanks again

Private Sub FindWhat_AfterUpdate()
If Me.Text0 = 1 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl 'AciveControl = FindWhat
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 2 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "ATERefNum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 3 Then ' This code gives same problem as 4
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

Dim frm As Form
Dim strFilter As String
If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then
frm.Dirty = flase
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter 'Getting same you canceled the previous operation
error here
frm.FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

goout:
Set frm = Nothing

End Sub

Allen Browne said:
Don't include the form name in the Filter string.

Access will not be able to apply the filter if the form is dirty with a
record that can't be saved (e.g. validation rule not met).

Dim frm As Form
Dim strFilter As String

If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then 'Save any changes
frm.Dirty = False
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter
frm.FilterOn = True
'show/hide your controls here.
End If
Set frm = Nothing


The data type of the CheckNum field must be the same as the value you are
trying to set it to, and must have the corrrect delimiters. If CheckNum
is
a
Number field, then FindWhat must be a number (not a word or a Null). If
CheckNum is a Text type field, you need quote marks around the value to
find, i.e.:
strFilter = "CheckNum = """ & Me.FindWhat & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
I don't understand why I am getting the "You canceled the previous operation
in the code below.

Any help would be appreciated.

If Me.Text0 = 4 Then
Dim FindingWhat As Integer
FindingWhat = FindWhat 'The input box text value on my form. In this
instance 26700'
Forms![ate order for specific customer].Filter = "[all ate orders for
specific customer].CheckNum =" & FindingWhat
'Stops on above line with "You canceled the previous operation" error
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
End If
 
InvNum = Number
ATERefNum = Number
CheckNum = Text
Text0 is not bound to a field. Just a data entry textbox to capture the
input.
Thanks again
Chuck
Allen Browne said:
What is the data type of the invnum field in your table?
What is the data type of the ATERefNum field in your table?
What is the data type of the CheckNum field in your table?
Is text0 bound to a field?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")
Chaster said:
Allen,
Thanks for your response but I am still getting the same you cancelled the
previous operation with your code. There is code before the if me.text0
=
4
line so I am enclosing it and ask that you look at it to see if there is
something in that code that may be causing this problem.
Thanks again

Private Sub FindWhat_AfterUpdate()
If Me.Text0 = 1 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl 'AciveControl = FindWhat
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 2 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "ATERefNum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 3 Then ' This code gives same problem as 4
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

Dim frm As Form
Dim strFilter As String
If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then
frm.Dirty = flase
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter 'Getting same you canceled the previous operation
error here
frm.FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

goout:
Set frm = Nothing

End Sub

Allen Browne said:
Don't include the form name in the Filter string.

Access will not be able to apply the filter if the form is dirty with a
record that can't be saved (e.g. validation rule not met).

Dim frm As Form
Dim strFilter As String

If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then 'Save any changes
frm.Dirty = False
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter
frm.FilterOn = True
'show/hide your controls here.
End If
Set frm = Nothing


The data type of the CheckNum field must be the same as the value you are
trying to set it to, and must have the corrrect delimiters. If
CheckNum
is
a
Number field, then FindWhat must be a number (not a word or a Null). If
CheckNum is a Text type field, you need quote marks around the value to
find, i.e.:
strFilter = "CheckNum = """ & Me.FindWhat & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

I don't understand why I am getting the "You canceled the previous
operation
in the code below.

Any help would be appreciated.

If Me.Text0 = 4 Then
Dim FindingWhat As Integer
FindingWhat = FindWhat 'The input box text value on my form. In this
instance 26700'
Forms![ate order for specific customer].Filter = "[all ate orders for
specific customer].CheckNum =" & FindingWhat
'Stops on above line with "You canceled the previous operation" error
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
End If
 
CheckNum is text? Then you need the extra quotes:
strFilter = "CheckNum = """ & Me.FindWhat & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
InvNum = Number
ATERefNum = Number
CheckNum = Text
Text0 is not bound to a field. Just a data entry textbox to capture the
input.
Thanks again
Chuck
Allen Browne said:
What is the data type of the invnum field in your table?
What is the data type of the ATERefNum field in your table?
What is the data type of the CheckNum field in your table?
Is text0 bound to a field?
me.text0
=
4
line so I am enclosing it and ask that you look at it to see if there is
something in that code that may be causing this problem.
Thanks again

Private Sub FindWhat_AfterUpdate()
If Me.Text0 = 1 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl 'AciveControl = FindWhat
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 2 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "ATERefNum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 3 Then ' This code gives same problem as 4
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

Dim frm As Form
Dim strFilter As String
If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then
frm.Dirty = flase
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter 'Getting same you canceled the previous operation
error here
frm.FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

goout:
Set frm = Nothing

End Sub

Don't include the form name in the Filter string.

Access will not be able to apply the filter if the form is dirty
with
a
record that can't be saved (e.g. validation rule not met).

Dim frm As Form
Dim strFilter As String

If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then 'Save any changes
frm.Dirty = False
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter
frm.FilterOn = True
'show/hide your controls here.
End If
Set frm = Nothing


The data type of the CheckNum field must be the same as the value
you
are
trying to set it to, and must have the corrrect delimiters. If
CheckNum
is
a
Number field, then FindWhat must be a number (not a word or a Null). If
CheckNum is a Text type field, you need quote marks around the value to
find, i.e.:
strFilter = "CheckNum = """ & Me.FindWhat & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

I don't understand why I am getting the "You canceled the previous
operation
in the code below.

Any help would be appreciated.

If Me.Text0 = 4 Then
Dim FindingWhat As Integer
FindingWhat = FindWhat 'The input box text value on my form. In this
instance 26700'
Forms![ate order for specific customer].Filter = "[all ate orders for
specific customer].CheckNum =" & FindingWhat
'Stops on above line with "You canceled the previous operation" error
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
End If
 
Worked Perfectly. I'm sorry I did not catch that on your previous reply.

Thanks for sticking with me.

Chuck
Allen Browne said:
CheckNum is text? Then you need the extra quotes:
strFilter = "CheckNum = """ & Me.FindWhat & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
InvNum = Number
ATERefNum = Number
CheckNum = Text
Text0 is not bound to a field. Just a data entry textbox to capture the
input.
Thanks again
Chuck
cancelled
the me.text0
there
is
something in that code that may be causing this problem.
Thanks again

Private Sub FindWhat_AfterUpdate()
If Me.Text0 = 1 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl 'AciveControl = FindWhat
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 2 Then 'This Code Works Fine
Forms![ate order for specific customer].Filter = "ATERefNum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

If Me.Text0 = 3 Then ' This code gives same problem as 4
Forms![ate order for specific customer].Filter = "invnum =" &
Me.ActiveControl
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

Dim frm As Form
Dim strFilter As String
If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then
frm.Dirty = flase
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter 'Getting same you canceled the previous operation
error here
frm.FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
GoTo goout
End If

goout:
Set frm = Nothing

End Sub

Don't include the form name in the Filter string.

Access will not be able to apply the filter if the form is dirty
with
a
record that can't be saved (e.g. validation rule not met).

Dim frm As Form
Dim strFilter As String

If Me.Text0 = 4 And IsNumeric(Me.FindWhat) Then
Set frm = Forms![ate order for specific customer]
If frm.Dirty Then 'Save any changes
frm.Dirty = False
End If
strFilter = "CheckNum = " & Me.FindWhat
frm.Filter = strFilter
frm.FilterOn = True
'show/hide your controls here.
End If
Set frm = Nothing


The data type of the CheckNum field must be the same as the value you
are
trying to set it to, and must have the corrrect delimiters. If CheckNum
is
a
Number field, then FindWhat must be a number (not a word or a
Null).
If
CheckNum is a Text type field, you need quote marks around the
value
to
find, i.e.:
strFilter = "CheckNum = """ & Me.FindWhat & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

I don't understand why I am getting the "You canceled the previous
operation
in the code below.

Any help would be appreciated.

If Me.Text0 = 4 Then
Dim FindingWhat As Integer
FindingWhat = FindWhat 'The input box text value on my form. In this
instance 26700'
Forms![ate order for specific customer].Filter = "[all ate
orders
for
specific customer].CheckNum =" & FindingWhat
'Stops on above line with "You canceled the previous operation" error
Forms![ate order for specific customer].FilterOn = True
Forms![ate order for specific customer]![FilterIsOn].Visible = True
Forms![ate order for specific customer]![NotFiltered].Visible = False
Forms![ate order for specific customer]![Company].Visible = True
DoCmd.Close
End If
 
Back
Top