Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting ADO Table Filter Anyone ?

Status
Not open for further replies.

Oppenhiemer

Programmer
Jun 28, 2001
315
GB
Hi..

I am using the ADO components in Delphi 6 to connect to a MIcrosoft Access 97 table. All is well, until I try filter the records.

The Access table in question has a field called InvNo and is of type "text". I would like to filter those records that have the value "INVOICE" in this field.

Here is the filter I am currently using (being set from code when form loads.)

Filter := 'InvoiceType = ' + AnsiQuotedStr('INVOICE', '"');

I am using the AnsiQuotedStr function, as Access uses the " character instead of the ' character. Delphi does not complain about the format of the filter, but no records are returned (so it dont work basically.)

Does anyone know the correct format for the filter given the type of database I am using ?

Cheers..

Opp.

 
Just found out that it may be the Microsoft.Jet.OLEDB thats the problem (go figure.)

What little I can understand from this subject, is that the Microsoft Jet OLE DB Version 3.51 Driver does not accept filters ?

When I try make a connection to an Access 2000 database using Jet OLE DB Version 4.XX and the same filter/Query components - I can succesfully filter the data.

In summary.. You cant seem to filter records from an Access 97 table using the Jet OLE DB driver 3.51 (or even Jet OLE DB driver 4.XX.)

You can however filter records froom an Access 2000 Database using version 4.XX of the OLE driver.

Oh well.. Sigh.. Back to the drawing barod I guess. If anyone can shed some light on this, I would be very greatful.

Cheers..
Opp.

 
Just a thought, but what about using a Range instead of a filter. I havent used them personally but I have seen them documented in the helpfile.

Continuing my vagueness, I cant even remember the difference between a range and a filter but, you never know until you try...

Arte Et Labore [rockband]
 
Thanks for your reply Eric - but looks like the TADOTable does not support that method.

Im pretty sure its a restriction of either Access 97 and/or the JET OLE DB 3.51 driver now. I say this because all works as you would expect using Access 2000 Database and the version 4.XX OLE DB driver.

Opp.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top