System said it was bust so I am sending reply again.
I tried: =Sum(Val(IIf([1/8/2008] Like "U",[1/8/2008],0))) because [Flag] is
not in the resultant query (it is only in orignal table). The result was
zero (0)! Not sure why that is happening. I am wondering if I need a
crosstab query that will have two columns for the same date (one wiht the
flagged data and one with only the values) that can be combinded in the
report. Is that possible? I did not think I would have som much trouble
with this.
javablood
:
Try this --
=Sum(Val(IIf([Flag]="U",[1/8/2008], 0)))
:
Karl,
Sorry about that double reply but the system said my first one did not go
through. Anyway, I got the sum to work by =sum(VAL([1/8/2008])) and even in
the report footer. However, it sums all the records not just the ones
without the "U". I need an iff statement to ignore the fields that contain
"U". Any ideas.
--
javablood
:
Would there be any reason that one cannot use sum in the report header?
I do not know about that.
Try =sum(CDbl([1/2/2008]))
This converts text to a number.
:
I run into the error "Data type mismatch in criteria expression" when I try
to run the query.
I also got this error when I tried to use the sum in the report header and
not sure why. Because my list of chemicals takes up more than one page it is
better if the sum is at the bottom of the list. Would there be any reason
that one cannot use sum in the report header?
Always something!
--
javablood
:
Ok, back up a little. Use you crosstab query in a totals query just to sum
the columns and not group on any other fields.
See if it will sum.
:
I typed it correctly (as you showed it) and it did not work.
--
javablood
:
If you typed it as posted --- =sum[(1/2/2008]) then it will not work.
Try =sum([1/2/2008])
:
Yes I have. I created a box in the footer with the control source:
=sum[(1/2/2008]) for each respective date and I get an "#error" in the
resulting report. I am not very sophisticated in Access so thank you for
bearing with me. But I learn much from you all.
--
javablood
:
I noticed that when I put this query into the report the values become text.
What makes you think they become text?
You should still sum in a footer. Did you try it?
:
Thanks Karl. Any idea about the text and values questions?
--
javablood
:
Drop the fields that are not needed from the GROUP BY to look like this --
TRANSFORM First(IIf([Flag]="U",[Value] & " " & [Flag],[Value])) AS RptValue
SELECT [V-Trench_Influent].PARAMETER, Client_PAR.F1_GRPORDR
FROM [V-Trench_Influent] INNER JOIN Client_PAR ON
[V-Trench_Influent].PARAMETER = Client_PAR.PARAMETER
WHERE ((([V-Trench_Influent].SAMPLE_DATE)>#1/1/2008#) AND
((Client_PAR.F1_GROUP)="VOA"))
GROUP BY [V-Trench_Influent].PARAMETER, Client_PAR.F1_GRPORDR
ORDER BY Client_PAR.F1_GRPORDR
PIVOT [V-Trench_Influent].SAMPLE_DATE;
:
Karl,
Thank you for your response. Here is the SQL:
TRANSFORM First(IIf([Flag]="U",[Value] & " " & [Flag],[Value])) AS RptValue
SELECT [V-Trench_Influent].PARAMETER, Client_PAR.F1_GRPORDR
FROM [V-Trench_Influent] INNER JOIN Client_PAR ON
[V-Trench_Influent].PARAMETER = Client_PAR.PARAMETER
WHERE ((([V-Trench_Influent].SAMPLE_DATE)>#1/1/2008#) AND
((Client_PAR.F1_GROUP)="VOA"))
GROUP BY [V-Trench_Influent].STATION_ID, [V-Trench_Influent].PARAMETER,
[V-Trench_Influent].RESULT, [V-Trench_Influent].VALUE,
[V-Trench_Influent].FLAG, [V-Trench_Influent].DETECTED,
Client_PAR.F1_GRPORDR, Client_PAR.F1_GROUP, [V-Trench_Influent].FLAG
ORDER BY Client_PAR.F1_GRPORDR
PIVOT [V-Trench_Influent].SAMPLE_DATE;
I pull the data from either text or value fields depending on whether a
chemical was detected because I want to be able to sum the values in the
report per sampling event (date). However, I noticed that when I put this
query into the report the values become text. Is there a way to keep the
values as values so I may sum the values?
TIA!
--
javablood
:
Yes, post the SQL of your crosstab query.
Open in design view, click on VIEW - SQL View, highlight all, copy, paste in
a post.
:
I have a crosstab query that has chemicals in the rows, dates in the columns,
and concentrations (value). When I create a report I am able to line up my
chemicals with my values (thanks to previous discussion group
questions/answers) with the exception of chemicals with values that are
different according to date. It would look something like this:
Date1 Date2 Date3 Date4
Chem1 5U 5U 5U 5U
Chem2 5U
10
20
30
Is there a way to get the values for Chem2 on the same line?
TIA!