D
doyle60
I have 24 queries or so that run data by Day. I just realized I may
want to see data by Year. Rather than do a whole set of 24 queries all
over again, I see that if I just interrupt one with a little If-Else
code, I could be set.
One of the queries is this:
SELECT A2OnHandByDayqry.*
FROM A2OnHandByDayqry;
So I created one other query by Year and tried to write an If-Else in
SQL. It didn't work. I think I'm mixing SQL with VB. I tried this
(having a form with a combo box called "DayYearChosen"):
If Forms!MyForm!DayYearChosen = "Day" Then
SELECT A2OnHandByDayqry.*
FROM A2OnHandByDayqry;
Else
SELECT A2OnHandByYearqry.*
FROM A2OnHandByYearqry;
End If
Something tells me I need some quotation marks or something.
Thanks,
Matt
want to see data by Year. Rather than do a whole set of 24 queries all
over again, I see that if I just interrupt one with a little If-Else
code, I could be set.
One of the queries is this:
SELECT A2OnHandByDayqry.*
FROM A2OnHandByDayqry;
So I created one other query by Year and tried to write an If-Else in
SQL. It didn't work. I think I'm mixing SQL with VB. I tried this
(having a form with a combo box called "DayYearChosen"):
If Forms!MyForm!DayYearChosen = "Day" Then
SELECT A2OnHandByDayqry.*
FROM A2OnHandByDayqry;
Else
SELECT A2OnHandByYearqry.*
FROM A2OnHandByYearqry;
End If
Something tells me I need some quotation marks or something.
Thanks,
Matt