wvandenberg
Technical User
Hi all,
I have a crosstab query
When I try and open it, sometimes I get the error "Data type mismatch in criteria expression". I'm pretty sure the error occurs when the highlighted expressions evaluate to TRUE and the Val([ResultCALC]) function has to run.
So, I changed the expression to
However, then the Max() function doesn't work properly, I think because it's taking the max of text rather than numbers. Could anyone shed some light on this dilemma. Should I make a custom Max() function? If so, any suggestions?
Thanks in advance,
Wendy
I have a crosstab query
Code:
TRANSFORM Max(IIf([P_GroupID]=7,IIf([Symbol]=">",Replace([ResultCALC],"-",[Symbol],1,1),Val([ResultCALC])),Val([ResultCALC]))) AS Result
SELECT qselWizExpResults2Sort.P_Analyte AS Analyte, qselWizExpResults2Sort.P_Group AS [Group], qselWizExpResults2Sort.Unit
FROM qselWizExpResults2Sort
GROUP BY qselWizExpResults2Sort.P_Analyte, qselWizExpResults2Sort.P_Group, qselWizExpResults2Sort.Unit, qselWizExpResults2Sort.GroupOrder, qselWizExpResults2Sort.AnalyteOrder
ORDER BY qselWizExpResults2Sort.GroupOrder, qselWizExpResults2Sort.AnalyteOrder, [SiteName] & " " & Format([StartDate],"dd-mmm-yyyy")
PIVOT [SiteName] & " " & Format([StartDate],"dd-mmm-yyyy");
Code:
IIf([highlight][P_GroupID]=7[/highlight],IIf(([highlight][Symbol]=">"[/highlight],(Replace([ResultCALC],"-",[Symbol],1,1),Val([ResultCALC])),Val([ResultCALC])))
Code:
IIf[P_GroupID]=7,IIf(([Symbol]=">",(Replace([ResultCALC],"-",[Symbol],1,1),CStr([ResultCALC])),Val([ResultCALC])))
Thanks in advance,
Wendy