I have an append query that I use to create an archive table. The SQL is below:
The query works fine. It pulls data from a summary query based on the primary record table. The part I need help with is this. The key value they need to be able to track is the [Age Category]. This field generally has values of: 1-5 days, 6-10 days, 11-15 days, and 16+ days. However, the primary table may, at any time, be missing records for any one of these category values.
What they want is, where the category value has no records, to insert into the Archive table a row where the [#Items] and [Current Value] fields are null (but the [Report Date], [Item Type] and [Age Category] fields are populated).
Is this something I can force/trick either the Summary Query or the Append Query into doing for me, or am I better off writing this into the macro that runs the stored procedure?
Code:
INSERT INTO tbl_RecallArchive ( [Report Date], [Item Type], [Age Category], [#Items], [Current Value] )
SELECT Date() AS [Report Date], smry_RecallsAging.[Item Type], smry_RecallsAging.[Age Category], smry_RecallsAging.[#Items], smry_RecallsAging.[Current Value]
FROM smry_RecallsAging;
What they want is, where the category value has no records, to insert into the Archive table a row where the [#Items] and [Current Value] fields are null (but the [Report Date], [Item Type] and [Age Category] fields are populated).
Is this something I can force/trick either the Summary Query or the Append Query into doing for me, or am I better off writing this into the macro that runs the stored procedure?