Re: Runtime Error 2001,when setting filter.
- From: "Lars Pedersen" <no>
- Date: Tue, 7 Jun 2005 10:36:10 +0200
But I ran into another problem, the filter will to long to be applied :-(
/Lars
"Lars Pedersen" <no> wrote in message
news:%23M1yUgzaFHA.2124@xxxxxxxxxxxxxxxxxxxxxxx
> Thank you very much, now it works.(I found the code on internet, and was
> making it work for me. obviously I haven't got the fundamentals right,
> since I did not se that one)
>
> /Lars
>
> "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
> news:uJlxl3yaFHA.3040@xxxxxxxxxxxxxxxxxxxxxxx
>> The message means that Access cannot complete the current action (turning
>> the FilterOn), because the previous action is now found to be invalid.
>> The previous operation is therefore assigning the string to the Filter,
>> and the message is telling you that the Filter string you assigned is
>> malformed.
>>
>> If ID is a Number field (not a Text field), lose the extra quotes, i.e.:
>> Criteria = Criteria & " ID = " & Me![lstShipInfo].ItemData(i)
>>
>> That will still be invalid if ItemData(i) is null or a zero-length
>> string.
>>
>> --
>> Allen Browne - Microsoft MVP. Perth, Western Australia.
>> Tips for Access users - http://allenbrowne.com/tips.html
>> Reply to group, rather than allenbrowne at mvps dot org.
>>
>> "Lars Pedersen" <no> wrote in message
>> news:OGPgk9uaFHA.3144@xxxxxxxxxxxxxxxxxxxxxxx
>>> Hi there.
>>> I am getting run-time error 2001 "You cancled the previus operation",
>>> when my code reach
>>> the frmFilterOn=true . I can not find out what operation it is talking
>>> about and why, can anyone help me.
>>> The code is on a popup search form, ID is autonumber that uniquely
>>> identifies the record
>>>
>>> Code:
>>> Private Sub cmdUseAsFilter_Click()
>>> Dim Criteria As String
>>> Dim i As Variant
>>> Dim frm As Form
>>> Set frm = Forms(Me.OpenArgs)
>>> ' Build criteria string from selected items in list box.
>>> Criteria = ""
>>> For Each i In Me![lstShipInfo].ItemsSelected
>>> If Criteria <> "" Then
>>> Criteria = Criteria & " OR "
>>> End If
>>> Criteria = Criteria & " ID = '" & Me![lstShipInfo].ItemData(i) &
>>> "'"
>>> Next i
>>> ' Filter the form using selected items in the list box.
>>> frm.Filter = Criteria
>>> frm.FilterOn = True
>>> DoCmd.Close acForm, Me.Name
>>> End Sub
>>
>>
>
>
.
- Follow-Ups:
- Re: Runtime Error 2001,when setting filter.
- From: Allen Browne
- Re: Runtime Error 2001,when setting filter.
- References:
- Runtime Error 2001,when setting filter.
- From: Lars Pedersen
- Re: Runtime Error 2001,when setting filter.
- From: Allen Browne
- Re: Runtime Error 2001,when setting filter.
- From: Lars Pedersen
- Runtime Error 2001,when setting filter.
- Prev by Date: Re: Query in Code not working
- Next by Date: Re: need help calling a form
- Previous by thread: Re: Runtime Error 2001,when setting filter.
- Next by thread: Re: Runtime Error 2001,when setting filter.
- Index(es):
Relevant Pages
|