B
Bill R via AccessMonster.com
I am aware from previous posts of mine that parameter data types must be
defined in crosstab queries. I had understood that data derived from a
control in an open form required this definition. However, the following
query, at this stage of development, is using data directly derived from
underlying queries, along with numbers inserted for the calculation. Yet I
still get the "Data type mismatch in criteria expression" error.
I hope someone can spot the cause of the error.
Here is the sql:
Underlying queries:
qryHtRtCurves (qryCurve1 and qryCurve2 are simple select statements on the
same table):
SELECT qryCurve1.SpotMonth, qryCurve1.Volatility AS PwrVol, qryCurve1.Float
AS PwrPrice, qryCurve1.Factor AS Hrs, qryCurve2.Volatility AS GasVol,
qryCurve2.Float AS GasPrice
FROM qryCurve2 INNER JOIN qryCurve1 ON qryCurve2.SpotMonth = qryCurve1.
SpotMonth;
Params3:
SELECT qryHtRtCurves.SpotMonth AS CalcMonth, Sqr([PwrVol]*[PwrVol]+([GasVol]*
[GasPrice]/(7.5*[GasPrice]+0))^2-2*0.75*[PwrVol]*[GasVol]*[GasPrice]/(7.5*
[GasPrice]+0)) AS SpreadVol
FROM qryHtRtCurves;
Crosstab:
TRANSFORM IIf(First([SpotMonth]/IIf([CalcMonth]=0,1,[CalcMonth]))<1,0,
(PwrPrice-(7.5*GasPrice))*Exp(-0.15*CalcMonth/12)+12*(1-Exp(-0.
15*CalcMonth/12))+1.645*SpreadVol*Sqr((1-Exp(-2*0.15*CalcMonth/12))/(2*0.15)))
AS Expr1
SELECT Params.SpotMonth, Params.PwrVol, Params.PwrPrice, Params.Hrs, Params.
GasVol, Params.GasPrice, Params3.SpreadVol
FROM qryHtRtCurves AS Params, Params3
WHERE (((Params3.CalcMonth)>0))
GROUP BY Params.SpotMonth, Params.PwrVol, Params.PwrPrice, Params.Hrs, Params.
GasVol, Params.GasPrice, Params3.SpreadVol
PIVOT Params3.CalcMonth;
defined in crosstab queries. I had understood that data derived from a
control in an open form required this definition. However, the following
query, at this stage of development, is using data directly derived from
underlying queries, along with numbers inserted for the calculation. Yet I
still get the "Data type mismatch in criteria expression" error.
I hope someone can spot the cause of the error.
Here is the sql:
Underlying queries:
qryHtRtCurves (qryCurve1 and qryCurve2 are simple select statements on the
same table):
SELECT qryCurve1.SpotMonth, qryCurve1.Volatility AS PwrVol, qryCurve1.Float
AS PwrPrice, qryCurve1.Factor AS Hrs, qryCurve2.Volatility AS GasVol,
qryCurve2.Float AS GasPrice
FROM qryCurve2 INNER JOIN qryCurve1 ON qryCurve2.SpotMonth = qryCurve1.
SpotMonth;
Params3:
SELECT qryHtRtCurves.SpotMonth AS CalcMonth, Sqr([PwrVol]*[PwrVol]+([GasVol]*
[GasPrice]/(7.5*[GasPrice]+0))^2-2*0.75*[PwrVol]*[GasVol]*[GasPrice]/(7.5*
[GasPrice]+0)) AS SpreadVol
FROM qryHtRtCurves;
Crosstab:
TRANSFORM IIf(First([SpotMonth]/IIf([CalcMonth]=0,1,[CalcMonth]))<1,0,
(PwrPrice-(7.5*GasPrice))*Exp(-0.15*CalcMonth/12)+12*(1-Exp(-0.
15*CalcMonth/12))+1.645*SpreadVol*Sqr((1-Exp(-2*0.15*CalcMonth/12))/(2*0.15)))
AS Expr1
SELECT Params.SpotMonth, Params.PwrVol, Params.PwrPrice, Params.Hrs, Params.
GasVol, Params.GasPrice, Params3.SpreadVol
FROM qryHtRtCurves AS Params, Params3
WHERE (((Params3.CalcMonth)>0))
GROUP BY Params.SpotMonth, Params.PwrVol, Params.PwrPrice, Params.Hrs, Params.
GasVol, Params.GasPrice, Params3.SpreadVol
PIVOT Params3.CalcMonth;