S
Secret Squirrel
I want to be able to count the # of records based on two criterias. First I
want to count all records that are in the month of "January" and then only
count the # of records that have a variance of greater than 1 day but less
than 4 days. I want to put this into my control source in a textbox on my
main form. The query detail is on my subform. How would I write the
calculation to do this count/iif?
Here is my query. The variance I'm looking for comes from the expression
called "VOrigDate".
SELECT qryUnionPerformance.RecordID, qryUnionPerformance.VendorID,
qryUnionPerformance.PurchaseOrderNo, qryUnionPerformance.PartNo,
qryUnionPerformance.OrderQty, qryUnionPerformance.RecQty,
qryUnionPerformance.OrigDate, qryUnionPerformance.LastDate,
qryUnionPerformance.RecDate, Format([RecDate],"yyyy") AS Years,
Format([RecDate],"mmmm") AS Months,
DateDiff("d",[OrigDate],[RecDate])-(DateDiff("ww",[OrigDate],[RecDate],7)+DateDiff("ww",[OrigDate],[RecDate],1))
AS VOrigDate,
DateDiff("d",[LastDate],[RecDate])-(DateDiff("ww",[LastDate],[RecDate],7)+DateDiff("ww",[LastDate],[RecDate],1)) AS VLastDate
FROM qryUnionPerformance
WHERE
(((qryUnionPerformance.VendorID)=[Forms]![frmPerformanceMain]![VendorID]) AND
((Format([RecDate],"yyyy"))=[Forms]![frmPerformanceMain]![cboYearSelect]));
want to count all records that are in the month of "January" and then only
count the # of records that have a variance of greater than 1 day but less
than 4 days. I want to put this into my control source in a textbox on my
main form. The query detail is on my subform. How would I write the
calculation to do this count/iif?
Here is my query. The variance I'm looking for comes from the expression
called "VOrigDate".
SELECT qryUnionPerformance.RecordID, qryUnionPerformance.VendorID,
qryUnionPerformance.PurchaseOrderNo, qryUnionPerformance.PartNo,
qryUnionPerformance.OrderQty, qryUnionPerformance.RecQty,
qryUnionPerformance.OrigDate, qryUnionPerformance.LastDate,
qryUnionPerformance.RecDate, Format([RecDate],"yyyy") AS Years,
Format([RecDate],"mmmm") AS Months,
DateDiff("d",[OrigDate],[RecDate])-(DateDiff("ww",[OrigDate],[RecDate],7)+DateDiff("ww",[OrigDate],[RecDate],1))
AS VOrigDate,
DateDiff("d",[LastDate],[RecDate])-(DateDiff("ww",[LastDate],[RecDate],7)+DateDiff("ww",[LastDate],[RecDate],1)) AS VLastDate
FROM qryUnionPerformance
WHERE
(((qryUnionPerformance.VendorID)=[Forms]![frmPerformanceMain]![VendorID]) AND
((Format([RecDate],"yyyy"))=[Forms]![frmPerformanceMain]![cboYearSelect]));