In my union query I want to select * from up to three select queries depending on checkboxes on a form. I always want my union query to include SelectQuery1. If the first checkbox on the form is checked, I also want my union query to include the data from SelectQuery2 and if the first and second checkboxes are checked, I want my union query to include the data from SelectQuery2 and SelectQuery3. Here is what I have:
select * from [SelectQuery1]
union all select * from [SelectQuery2]
union all select * from [SelectQuery3];
This will, of course, make a query with the data from all three select queries. What code can I add to make the second and third line conditional on the checkboxes on the form? Thank you very much in advance!
Will
select * from [SelectQuery1]
union all select * from [SelectQuery2]
union all select * from [SelectQuery3];
This will, of course, make a query with the data from all three select queries. What code can I add to make the second and third line conditional on the checkboxes on the form? Thank you very much in advance!
Will