I am trying to write a query that will give me a running total of the demand qty for each part number sorted by date. I have created a unique filed that includes part number, date, and order number that is unique for each record. I then sort on that unique filed.
Query1 UniqueRecord UniqueRecordAlias PartNo RT RT2 7306620140225300535230000 7306620140225300535230000 73066 3760.828
7306620140402300537900000 7306620140402300537900000 73066 3760.828
7306620140407300537910000 7306620140407300537910000 73066 3760.828
7306620140416300541090000 7306620140416300541090000 73066 3760.828
The field RT gives me a total of all demand for that part number. The field RT2 errors out.
SELECT qryMRPDetail_PartShortages_Sub.UniqueRecord, qryMRPDetail_PartShortages_Sub.UniqueRecordAlias, qryMRPDetail_PartShortages_Sub.PartNo, DSum("DemandQty","tblMRPDetail_PartShortages","[PartNo] = '73066'") AS RT, DSum("[DemandQty]","qryMRPDetail_PartShortages_Sub","[UniqueRecord] <= " & [UniqueRecordAlias] & "") AS RT2
FROM qryMRPDetail_PartShortages_Sub
GROUP BY qryMRPDetail_PartShortages_Sub.UniqueRecord, qryMRPDetail_PartShortages_Sub.UniqueRecordAlias, qryMRPDetail_PartShortages_Sub.PartNo
ORDER BY qryMRPDetail_PartShortages_Sub.UniqueRecord;
I tried doing the exercise in the Northwinds sample database and I could not get it to run either. All I got was #Error in my running total field.
Any help would be appreciated.
Lucy
Query1 UniqueRecord UniqueRecordAlias PartNo RT RT2 7306620140225300535230000 7306620140225300535230000 73066 3760.828
7306620140402300537900000 7306620140402300537900000 73066 3760.828
7306620140407300537910000 7306620140407300537910000 73066 3760.828
7306620140416300541090000 7306620140416300541090000 73066 3760.828
The field RT gives me a total of all demand for that part number. The field RT2 errors out.
SELECT qryMRPDetail_PartShortages_Sub.UniqueRecord, qryMRPDetail_PartShortages_Sub.UniqueRecordAlias, qryMRPDetail_PartShortages_Sub.PartNo, DSum("DemandQty","tblMRPDetail_PartShortages","[PartNo] = '73066'") AS RT, DSum("[DemandQty]","qryMRPDetail_PartShortages_Sub","[UniqueRecord] <= " & [UniqueRecordAlias] & "") AS RT2
FROM qryMRPDetail_PartShortages_Sub
GROUP BY qryMRPDetail_PartShortages_Sub.UniqueRecord, qryMRPDetail_PartShortages_Sub.UniqueRecordAlias, qryMRPDetail_PartShortages_Sub.PartNo
ORDER BY qryMRPDetail_PartShortages_Sub.UniqueRecord;
I tried doing the exercise in the Northwinds sample database and I could not get it to run either. All I got was #Error in my running total field.
Any help would be appreciated.
Lucy