Create a table containing all of the LegalDisp to join with your data table.
I used names Dennis_M and Dennis_M_Legal.
You mixed up the names by having 'Civil Penalties', 'CivilPenalties' and
'Civil Penalty' so it took a lot of time finding why things would not work.
This gets you half way there --
SELECT Dennis_M_Legal.LegalDisp, Count(XX.LegalDisp) AS [Monthly Count],
(SELECT Count([XX].LegalDisp) FROM Dennis_M AS [XX] WHERE
[Dennis_M_Legal].LegalDisp = [XX].LegalDisp AND ([XX].NoticeofHearing)
Between DateSerial(Year(Date()),1,1) and Date()-Day(Date()) ) AS [Year to
date]
FROM Dennis_M_Legal LEFT JOIN Dennis_M AS XX ON Dennis_M_Legal.LegalDisp =
XX.LegalDisp
WHERE (((XX.NoticeofHearing) Between Date()-Day(Date()) And
DateAdd("m",-1,(Date()-Day(Date()))+1)))
GROUP BY Dennis_M_Legal.LegalDisp;
I need some rules on Refunds, Civil Penalties, and the dates that would move
the displayed data to another location.
--
Build a little, test a little.
Dennis M said:
NoticeofHearing CivilPenalty LegalDisp DismissedDate
2/19/2009 $100.00 Civil Penalties 6/24/2009
3/25/2009 $100.00 Civil Penalties 6/3/2009
5/14/2009 $100.00 Civil Penalties 6/24/2009
7/22/2009 $900.00 Civil Penalties 9/2/2009
8/24/2009 $0.00 Dismissed
9/11/2009
8/24/2009 $0.00 Dismissed
9/11/2009
8/24/2009 $100.00 Civil Penalties 9/22/2009
8/24/2009 $0.00 Dismissed
9/11/2009
Hope this is what you meant.
:
Just run select query, a dozen or so records, with the following fields --
- NoticeofHearing - date (Date used for LegalDisp)
- CivilPenalty - currency (for dollars)
- LegalDisp - text (the type)
- DismissedDate - date (this is for refunds and civil penalty date)
--
Build a little, test a little.
:
Karl,
how do I get you a sample of the data.
The report is to be three columns
Legal name monthly count year to date count
Dismissed 10 15
Filed 20 50
Revocation 4 6
Pending
Censure
Suspended
Probation
Civil Penalty $100 $250
Refunds $5000 $2500
That is the desired report look.
The table hendings are
ID
LicenseNum
LegalStatus
LegalRefund
Licensee
ExamDate
DateSent
DateofDelivery
ResponseDueDate
ResponseReceived
REFUNDS - not used for this report
NoticeofHearing - date (Date used for LegalDisp)
Status
Notes
Reminders
CivilPenalty - currency (for dollars)
Corrected
LegalDate
LegalDisp - text (the type)
DismissedDate - date (this is for refunds and civil penalty date)
Hope this is usable Karl
Dennis
:
Post sample data and example of your desired results.
--
Build a little, test a little.
:
Karl,
I assume you intend this to be a query attached to the report.
Let me explain a little more:
The report has to columns: one is the text in LegaDisp, 8 different types,
and the other is a counting column for how many times in the month it has
been done, that column is deterimend by a date that appears in noticeof
hearing. I have accomplished the above with the text box with this in the
control source, =Count(IIf([LegalDisp]="Censure",0)) replacing censure with
what ever I am looking for to count. I have 8 of those.
The odd balls are the ones I need to sum tied to a different column for
date, that is what is throwing me. I am sorry I didn't give you more in the
beginning.
Of course the boss would love to see another column with year to date for
all of it also.
Thanks for help.
:
Try this --
SELECT Sum(iif([LegaDisp]="Dismissed", 1,0)) AS CountOfDismissed,
Sum(Nz([Refunds])
FROM YourTable
WHERE [notice of hearing] Between [start] AND [end];
Or this --
SELECT Sum(iif([LegaDisp]="Dismissed" AND [notice of hearing] Between
[start] AND [end], 1,0)) AS CountOfDismissed, Sum(IIF([closed] Between
[start] AND [end],Nz([Refunds], 0), 0) AS Refunded
FROM YourTable;
--
Build a little, test a little.
:
LegalDisp containes text ,"Dismissed", "Pending" etc... Refunds will be
dollar amounts.
I need to be able to count the dismissed and total the refunds by different
dates.
The dates for the items in the LegalDisp field are located i na column
called noticeof hearing and that is where I use the between [start] and
[end].
But the refunds come from closed dates that appear in a column called closed.
I am not a VB person, this is 2003 Access.
Thanks for your help
That may still be unclear hope you gtet the jest of it.
:
Your desire is not clear, but I'll toss out some random guidance. Sometimes,
it is helpful to create fields in the query, then use that field on the
report.
In your current expressions, you reference the fields [LegaDisp] and
[Refunds]. Are these the fields you want to reference? If not, then what
are the columns that you want to reference?
:
I have a monthly report that I count occurances between dates and I need to
sum columns refrencing a different column. The ones icount I use one column
the the one Isum will be a different column for dates.
In the rpeort I am justusing text boxes with Count
(iif(l[LegaDisp])="Dismissed",0)).
Sum(Nz([Refunds]) but I cant figue out how to reference the correct column
in the table.