Thanks for your response Tom,
This is a part of a bigger picture. I have a report with 10 subreports
this
is one of those subreports.
My table is tblCustomer, the fields I will be messing with areCustomerID,
ReferralDateReceived, OpenDate, and DischargeDate.
On my form I have an option group that allows the user to select which
quarter they and also a combo box to select the year. Once they select
these
items it populates a hidden text box called Text1. When they press the
submit button it will run the report with all the subreports and build the
proper Titles for the months. I was able to get everything working fine
with
Allen's help this past weekend. However, they came back with a different
requirement. Now they want to display how many records were still pending
(no Opendate completed that month for that record) at the end of each
month.
I see some of your logic. I guess I will need another hidden text box to
have it populated with the last day of the month for the first month of
the
quarter. If and referrals were received before hand count those now look
at
the OpenDate count only those that have a null value or have a date after
this month.
However, do I need to build 3 different queries and have them dynamically
fill in an unbound subreport for each of the 3 months?
This is something I was thinking of for the first month:
SELECT tblCustomer.ReferralDateReceived, tblCustomer.OpenDate,
DateDiff("m",[ReferralDateReceived],[OpenDate]) AS Months
FROM tblCustomer
WHERE (((tblCustomer.ReferralDateReceived)<=[Forms].[frmRpts].[Text1] And
(tblCustomer.ReferralDateReceived)<DateAdd("m",1,[Forms].[frmRpts].[Text1]))
AND ((tblCustomer.OpenDate)>=[Forms].[frmRpts].[Text1] And
(tblCustomer.OpenDate)<DateAdd("m",1,[Forms].[frmRpts].[Text1])) AND
((DateDiff("m",[ReferralDateReceived],[OpenDate]))>=1)) OR
(((tblCustomer.ReferralDateReceived)<=[Forms].[frmRpts].[Text1] And
(tblCustomer.ReferralDateReceived)<DateAdd("m",1,[Forms].[frmRpts].[Text1]))
AND ((tblCustomer.OpenDate) Is Null));
the next month I would replace ("m",1...
with ("m",2....
But I don't think that will work either.
Sample Data
CustomerID ReferralDateReceived OpenDate
12 9/7/05
13 9/7/05 9/8/05
14 9/8/05 10/1/05
15 9/8/05 10/15/05
16 9/8/05 11/3/05
17 9/8/05 10/15/05
18 10/2/05 12/03/05
Should expect to see
Qtrs
Oct Nov Dec
3 2 1
Anyway any suggestion will be greatly apprecited. I would be nice to be
able to do this in a crosstab, but I don't see how. I would assume for
now
that they want to count the records that did not have an open date before
the
end of the month.
Tom Ellison said:
Dear TT:
I would think that the test would be that the ReceiveDate be on or before
the end of each of these months and that the CompleteDate would be null
or
on or after the first of that same month.
I could try to code and test this but, if my query is to be directly
usable
by you, I should use the exact table and column names you have. So, if
you
want that help, please do the following:
1. see if you agree with my first statement
2. provide the table and column names
3. Provide a bit of sample data and the results you expect it to produce
You will probably need a table that provides the months of each quarter
as
well. I'll cook up something for that to show you as well.
Tom Ellison
I have a table say table A with customer information. I need to count
each
pending record for each month where the ReceiveDate <= that month, but
the
CompleteDate is null or > that month, and have it broken down by for
each
month of a quarter.
In other words it should display something like:
Jan Feb Mar
12 5 8
Now I guess I need to use DateDiff from ReceiveDate and CompleteDate,
but
somehow provide the first day of the quarter. I have a form that will
provide the criteria for the query say Forms!frmRpts.Text1, which will
display the first day of the quarter.
I hope I am thinking through this process correctly.
Thanks for any response in this matter.