Re: ADODB & Recordset.Filter -> Problem mit Verkettung

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hallo Matthias,

Hm. Ich habe mir die Filter-Geschichte bei devguru
angeschaut und da steht:

The Operator can only be one of the following:
= < > <= >= <> LIKE
If you use the LIKE operator, you can also use the *
or % wildcards as
the last character in the string or as the
first and last character in the string.

Also als letztes oder erstes und letztes (nicht aber
nur als erstes...).

Ja, hier sagt die Online-Hilfe was unzutreffendes.
Ich habe eben mal einen Filterausdruck '%x%' getestet.
Er funktioniert.

Ich habe gerade einen KB-Artikel (Nr. 235892) gefunden,
der wohl auf mein Problem zutrifft:

This error can occur if the filter syntax is incorrect.
This commonly occurs when using AND and OR operators
and grouping clauses with parentheses. Though there is no
precedence for AND and OR, the ADO Filter property
does not allow you to group OR clauses within parentheses
and AND clauses without parentheses.

Ja, ein entspr. Hinweis findet sich auch in der Online-Hilfe:

There is no precedence between AND and OR.
Clauses can be grouped within parentheses.
However, you cannot group clauses joined by an
OR and then join the group to another clause with
an AND, like this:
(LastName = 'Smith' OR LastName = 'Jones') AND
FirstName = 'John'

Aber auch dieser Vorschlag:

Instead, you would construct this filter as
(LastName = 'Smith' AND FirstName = 'John') OR
(LastName = 'Jones' AND FirstName = 'John')

In besonders hartnäckigen Fällen wäre auch noch
so was denkbar:

Dim RS as ADODB.Recordset
Dim RSc as ADODB.Recordset
Dim RScc as ADODB.Recordset

Set RS = new ADODB.Recordset
.....Rs erstellen....
Set RSc = RS.Clone
RSc.Filter = "erster Filter"
Set RScc = RSc.Clone
RScc.Filter = "zweiter Filter"

Gruß aus St.Georgen
Peter Götz
www.gssg.de (mit VB-Tipps u. Beispielprogrammen)


.



Relevant Pages

  • Re: How to LEFT JOIN with 2 conditions fails in Access and .NET Query
    ... recordset down to only those records in A where MyFilterValue is SomeValue. ... MyFilterValue - Some value to filter on. ... Ignoring parentheses, I ... where Access seems to be less finicky with subqueries than dealing the ...
    (microsoft.public.access.queries)
  • Re: Filter Recordset
    ... Julio wrote: ... you cannot group clauses joined by an OR and then join ... you would construct this filter as ... You will get a quicker response by posting to the newsgroup. ...
    (microsoft.public.scripting.vbscript)
  • RE: Use Filter To Print This Record Only
    ... The quotes in Where clauses always mess me up, ... "Bonnie" wrote: ... >> Filter Property. ...
    (microsoft.public.access.formscoding)
  • Re: pointfree notation
    ... Adding parentheses in the right place makes things a little clearer. ... so, then, by general properties of function composition, ... length o filter ... so that doesn't work in Haskell either. ...
    (comp.lang.functional)
  • Re: Left Join vs Right JOIN
    ... The order of the ON clauses ... LEFT JOIN table3 ... You can use parentheses as well. ... My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis ...
    (microsoft.public.sqlserver.programming)