G
Guest
I thought I had this problem solved, and now that I'm running *year-end*
reports I discover it's not solved. I have a query that is not functioning
properly on two of its fields. The query basically pulls fourth-quarter sales
data from a table. For all but two of the fields in the query, the amounts
for October, November, and December are summed. For two of the fields in the
query, I need to always pick the amounts from the last month for which we
have data during the quarter. For example, if I run the query in December, we
will only have October and November data, so I need the query to pick
November data for these two fields only. When I run the query in January, I
need it to pick December data for these two fields only.
Out of the SQL SELECT statement pasted below, please look at the two fields
enclosed in the Last() function. These are the ones where I need to pick up
the data of the last month in the quarter for which I have entered data. All
the other fields are summed; only the two enclosed in a Last() function are
the "problem" fields. Everything else works the way I want.
My question is this: how can I change my existing code to tell the query: On
the two fields enclosed in the Last() function, sort them by date and THEN
pick the most recent data for the quarter??????
Like I stated at the beginning of my post, this is a problem I thought I had
fixed. Right before a year-end deadline, it decides to show me it's not
fixed. Help!!!!!
GwenH
Desperate in Florida USA
reports I discover it's not solved. I have a query that is not functioning
properly on two of its fields. The query basically pulls fourth-quarter sales
data from a table. For all but two of the fields in the query, the amounts
for October, November, and December are summed. For two of the fields in the
query, I need to always pick the amounts from the last month for which we
have data during the quarter. For example, if I run the query in December, we
will only have October and November data, so I need the query to pick
November data for these two fields only. When I run the query in January, I
need it to pick December data for these two fields only.
Out of the SQL SELECT statement pasted below, please look at the two fields
enclosed in the Last() function. These are the ones where I need to pick up
the data of the last month in the quarter for which I have entered data. All
the other fields are summed; only the two enclosed in a Last() function are
the "problem" fields. Everything else works the way I want.
My question is this: how can I change my existing code to tell the query: On
the two fields enclosed in the Last() function, sort them by date and THEN
pick the most recent data for the quarter??????
Like I stated at the beginning of my post, this is a problem I thought I had
fixed. Right before a year-end deadline, it decides to show me it's not
fixed. Help!!!!!
GwenH
Desperate in Florida USA