By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

When I add criteria to a query, it won't run

P: n/a
MLH
This query runs fine and spits out all the records:
SELECT qryVehicleList.Vehicle, qryVehicleList.VehicleJobID AS VID,
qryVehicleList.ClusterID, qryVehicleList.ProcFee,
SumOfPayments([VID],"CarChuzer RowSource on frmPmtProcessor") AS
TotalPayments, [TotalPayments]-[ProcFee] AS Decision FROM
qryVehicleList WHERE
(((qryVehicleList.ClusterID)=GetCurrentClusterID() ));

This one fails:
SELECT qryVehicleList.Vehicle, qryVehicleList.VehicleJobID AS VID,
qryVehicleList.ClusterID, qryVehicleList.ProcFee,
SumOfPayments([VID],"CarChuzer RowSource on frmPmtProcessor") AS
TotalPayments, [TotalPayments]-[ProcFee] AS Decision FROM
qryVehicleList WHERE
(((qryVehicleList.ClusterID)=GetCurrentClusterID() )
AND (([TotalPayments]-[ProcFee])>=0));

It fails and asks me to enter parameter value for TotalPayments. The
only difference is the >=0 criteria I added. Otherwise, they are
identical.
May 11 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi, Mike.
It fails and asks me to enter parameter value for TotalPayments.
TotalPayments is an alias in the query, which can't be used in other
clauses, such as the WHERE clause. Change the following line:

AND (([TotalPayments]-[ProcFee])>=0));

To:

AND ((SumOfPayments([VID],"CarChuzer RowSource on frmPmtProcessor") -
[ProcFee])>=0));

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"MLH" <CR**@NorthState.netwrote in message
news:r5********************************@4ax.com...
This query runs fine and spits out all the records:
SELECT qryVehicleList.Vehicle, qryVehicleList.VehicleJobID AS VID,
qryVehicleList.ClusterID, qryVehicleList.ProcFee,
SumOfPayments([VID],"CarChuzer RowSource on frmPmtProcessor") AS
TotalPayments, [TotalPayments]-[ProcFee] AS Decision FROM
qryVehicleList WHERE
(((qryVehicleList.ClusterID)=GetCurrentClusterID() ));

This one fails:
SELECT qryVehicleList.Vehicle, qryVehicleList.VehicleJobID AS VID,
qryVehicleList.ClusterID, qryVehicleList.ProcFee,
SumOfPayments([VID],"CarChuzer RowSource on frmPmtProcessor") AS
TotalPayments, [TotalPayments]-[ProcFee] AS Decision FROM
qryVehicleList WHERE
(((qryVehicleList.ClusterID)=GetCurrentClusterID() )
AND (([TotalPayments]-[ProcFee])>=0));

It fails and asks me to enter parameter value for TotalPayments. The
only difference is the >=0 criteria I added. Otherwise, they are
identical.

May 11 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.