>Cetin,
>
>I don't know how can that work:
>
>My requirement is:
>
>if i select just the project:
>
>it should be like this:
>
>select * from custmers where project = thisform.text1.value
>
>****
>if i select project and contract both then:
>the query should be:
>
>select * from customers where projcet = thisform.text1.value and contract=thisform.text2.value
>
>*******
>if i just select contract the query should be like this:
>
>
>select * from customers where contract = thisform.text2.value
>
>********
>
>Please let me know the one you have provided will it work that way.
>
>Thank you very much Cetin.
Raj,
That's effectively what you get with a single direct SQL.
set ansi off
select * from customers ;
where project = trim(thisform.text1.value)and ;
contract=trim(thisform.text2.value)
Suppose for text1 you type 'myProject', for text2 'myContract' or leave anyone of this as empty (no selection) :
if you type only the project then it's translated as :
select * from customers ;
where project = 'myProject' and contract = ''
if you type only the contract then it's translated as :
select * from customers ;
where project = '' and contract = 'myContract'
if you type both then it's translated as :
select * from customers ;
where project = 'myProject' and contract = 'myContract'
if you type none then it's translated as :
select * from customers ;
where project = '' and contract = ''
with ANSI OFF setting and = operator (not == operator) :
where Project = 'myProject' means :
Where Project STARTS WITH 'myProject'
where Project = '' means :
Where project starts with '' ( IOW whatever it's - all projects match).
Cetin