L
Leo
Hello all. I need to build a query based on user input. What the user inputs
is the number of months and the program will do some calculations based on
the dates
so if a user enters 2, this means two months. Which is ok. But here's the
tricky part: 2 means the most recent months that have data.
so if I am in August running the program and enter 2, then I want that
program to select the most 2 recent months for which there is data. Ideally
it should be: June and July in this case. But that's easy.compared to when
there's data for July but there's no data for June. In this case I have to
go back until I find the next month with data and select everything for
those two month as well to make the two months
So I'm going back 2 months, starting with the most recent that has data,
going back until I find the next one and stopping there
So my question is, has anyone ever done this? If yes/or not could you give
me some ideas please? I'd greatly appreciate it
Leo
is the number of months and the program will do some calculations based on
the dates
so if a user enters 2, this means two months. Which is ok. But here's the
tricky part: 2 means the most recent months that have data.
so if I am in August running the program and enter 2, then I want that
program to select the most 2 recent months for which there is data. Ideally
it should be: June and July in this case. But that's easy.compared to when
there's data for July but there's no data for June. In this case I have to
go back until I find the next month with data and select everything for
those two month as well to make the two months
So I'm going back 2 months, starting with the most recent that has data,
going back until I find the next one and stopping there
So my question is, has anyone ever done this? If yes/or not could you give
me some ideas please? I'd greatly appreciate it
Leo