Link to home
Start Free TrialLog in
Avatar of sdf145
sdf145

asked on

problem with Filter property in ADO......?

hi
iwant to filter my data depend on date and cunsumerFamily in the following way:
for example                     month=2 AND cunsumerFamily=X
 another example             year=1985 AND  cunsumerFamily=X
but i dont know how to write a sql statement for ADO filter property that contained both date and consumerFamily with conditions above.
any help will be appreciated
thanks bayat
vb6
ado datacontrol
access 2000 database
Avatar of rockiroads
rockiroads
Flag of United States of America image

well u could do one of two ways

Actually specify this in your sql
e.g.

sSql = "SELECT * FROM Table Where Month=2 AND CunsumerFamily='X'"

then use this sql when u open the recordset

or use the recordset filter

rs.Find "Month=2 AND CunsumerFamily='X'"

Hi sdf145,
----------

did you try

rst.Filter = "Month=2 And ConsumerFamily <> 'X'"

----------
bruintje
share what you know, learn what you don't
Avatar of sdf145
sdf145

ASKER

it is not answer i am looking for
date field in database is in this format YYYY/MM/DD
but im looking for YYYY or MM
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sdf145

ASKER

thank u for ur attempt
u are perfect
glad your sorted and thanks