I am trying to run a query off of a form where customers can choose from multiple items to select either a specific item or 'all' items froma a particular field, while being specific in others.. hope I explained that properly..
For example..
Lets say, I have a database called "CARS" with 5 fields in it.. ( Brand, Model, Year, Color, Price )
And The customer chooses to search for:
Brand = "Ford", Model = "f-150", Year = ALL, Color = All and Price = between 10k and 20k
Query:
SELECT * from CARS
WHERE Brand = 'ford' AND Model = 'f-150' AND Year = (this is where my problem lies) AND Color = (again I am having a problem here) AND Price BETWEEN 10000 and 20000
Is there a way that I can get all the results from any particular field to appear while still being dependent on other fields?
I have made a workaround with doing an if..else statement for example..
If YEAR = "All" Then ... Run A different query without the YEAR field in it...
This does end up working... but I end up having like 99 if..else statements each running different queries
Is there another way of doing this...where I can just run one query.
Thanks for reading.
Agmac
For example..
Lets say, I have a database called "CARS" with 5 fields in it.. ( Brand, Model, Year, Color, Price )
And The customer chooses to search for:
Brand = "Ford", Model = "f-150", Year = ALL, Color = All and Price = between 10k and 20k
Query:
SELECT * from CARS
WHERE Brand = 'ford' AND Model = 'f-150' AND Year = (this is where my problem lies) AND Color = (again I am having a problem here) AND Price BETWEEN 10000 and 20000
Is there a way that I can get all the results from any particular field to appear while still being dependent on other fields?
I have made a workaround with doing an if..else statement for example..
If YEAR = "All" Then ... Run A different query without the YEAR field in it...
This does end up working... but I end up having like 99 if..else statements each running different queries
Is there another way of doing this...where I can just run one query.
Thanks for reading.
Agmac