i have a simple query and does not getting desire results which i want
i am using vb6 and access
i had a table with with 8 fields but just to simplyfy by question i am just
supposing to four.
suppose i had a table with field
Name----------City----------Type----------Value
Property1-----Karachi-----1-------------- 100
Property2---- Lahore------ 3-------------- 250
Property3----- Karachi---- 1------------- 50
Now, i had made a form to search the desired criteria
and the field which we can choose searh are
City Karachi
Type (Blank)
Value <200
and i am using the following query
i had also tried the querey replacing and with or but does not work
The problem is when we select all the criteria like city,type and value
the query work fine but if i left any one field blank to search it does not
show me any record or wrong recrod.
i want the query just like that if i select city (karachi) remaing all other criteria balnk then it show me only all the names haveing the city karachi.
and if i select select city (karachi) and type (1) then i had to show
me all the properties where city is karachi and type =1
hope you understant my question
Thanks in advance
i am using vb6 and access
i had a table with with 8 fields but just to simplyfy by question i am just
supposing to four.
suppose i had a table with field
Name----------City----------Type----------Value
Property1-----Karachi-----1-------------- 100
Property2---- Lahore------ 3-------------- 250
Property3----- Karachi---- 1------------- 50
Now, i had made a form to search the desired criteria
and the field which we can choose searh are
City Karachi
Type (Blank)
Value <200
and i am using the following query
Code:
"select * from property where city='" & citytextbox & "' and type ='" & typetextbox & "' and value <='" & valuetextbox & "'
The problem is when we select all the criteria like city,type and value
the query work fine but if i left any one field blank to search it does not
show me any record or wrong recrod.
i want the query just like that if i select city (karachi) remaing all other criteria balnk then it show me only all the names haveing the city karachi.
and if i select select city (karachi) and type (1) then i had to show
me all the properties where city is karachi and type =1
hope you understant my question
Thanks in advance
Comment