Re: Database Filter question



Thank you for your reply, I got it sorted now.

Allan


"Yannis" <None@xxxxxxxxxx> wrote in message
news:427f5980@xxxxxxxxxxxxxxxxxxxxxxxxx
> Allan Nielsen wrote:
>
> > Hello,
> >
> > I use ADO to connect to an SQL Database. I use an ADODataSet to hold a
> > complete recordset from a select query.
> >
> > Question 1:
> > When I set the Filtered property to True (ADODataset1.Filtered :=
> > true), will the dataset filter the current records that it holds, or
> > will it automatically Execute its CommandText and then filter the new
> > resultset? Or how does the Filter exactly work?
> >
> > Question 2:
> >
> > ------------------------------------------------------
> > number_before := ADODataSet1.RecordCount;
> > ADODataset1.Filter := 'address = ' +
> > ADODataset2.FieldByName('addr').AsString;
> > ADODataset1.Filtered := true;
> > number_after := ADODataset1.RecordCount;
> > -------------------------------------------------------
> >
> > Assuming that this actually filters out some records, the
> > number_before and number_after shouldn't be the same, right? Or does
> > it need a refresh somewhere?
> >
> > Delphi 2005, SQL Server 2K, btw.
> >
> > TIA
> >
> > Allan
>
> You are in the correct path You need to take in to account that the
> value needs to quoted, Change Filter property to the following
>
> ADODataset1.Filter := 'address = ' +
> QuotedStr(ADODataset2.FieldByName('addr').AsString);
>
> then test it again.
>
> Regards
> Yannis.


.



Relevant Pages

  • Re: Getting a subform to Show All records
    ... I don't think this is the root problem, ... I am unable to programmatically "unfilter" so that the subform displays all ... "If a form and its subform are both filtered and you remove the filter from ... RuralGuy aka Allan Bunch MS Access MVP - acXP WinXP Pro ...
    (microsoft.public.access.formscoding)
  • Re: Address list - filter by alphabet tabs
    ... the cursor in the field you want to filter on, ... Microcomputer solutions for industrial control "Allan" wrote in message ... > I have an address table and I want to be able to filter them in a multi tab> form. ...
    (microsoft.public.access.forms)
  • ADO Find Help?
    ... I'm using VB6, and an SQL database. ... ..Filter to do this, and believe I have it correct. ... The result of this is that when valueB changes, ... records that contain valueA. ...
    (microsoft.public.data.ado)
  • Re: Sorting data to last 30 days
    ... I think you should explore applying the filter to the SQL database so that ... There are problems with trying to use AutoFilter here: custom criteria don't ... filter criteria. ...
    (microsoft.public.excel.misc)
  • Re: ADO Find Help?
    ... Once the single record is found, ... > I'm using VB6, and an SQL database. ... > .Filter to do this, and believe I have it correct. ... > The result of this is that when valueB changes, ...
    (microsoft.public.data.ado)