The following query to determine which accounts were late in submitting a report works when no criteria is given for the number of days ("Which accounts were more than zero days late?"
, but prompts for [DueDate] when criteria is given in this field. It's as if the query stops recognizing the expression DueDate.
Table 1: GEN_ED_T
Fields:
FedTaxID 'text field holding tax id number
SubNo1: 'text field holding account number
Table 2: REQ$_T
Fields:
SubNo2: 'text field holding account number
ReqRcvdDate: 'date field holding date report recieved
MONTH: 'Text field holding month of report
Expressions in Query:
DueDate: 'determines the date report was due based on the MONTH field. Reports are due on the 15th of the following month (January's report is due February 15)
LateInDays: ' the number of days late, calculated by subtracting the DueDate from the date received
SELECT GEN_ED_T.FedTaxID, CDate((DateAdd("m",+1,CDate([MONTH] & " 15, " & IIf(DatePart("m",[ReqRcvdDate])<>1,CStr(DatePart("yyyy",[ReqRcvdDate])),CStr(DatePart("yyyy",DateAdd("yyyy",-1,[ReqRcvdDate])))))))) AS DueDate, [REQ$_T].ReqRcvdDate, [REQ$_T].MONTH, [ReqRcvdDate]-[DueDate] AS LateInDays
FROM GEN_ED_T INNER JOIN [REQ$_T] ON GEN_ED_T.SubNo1 = [REQ$_T].SubNo2
WHERE ((([REQ$_T].ReqRcvdDate) Is Not Null And ([REQ$_T].ReqRcvdDate) Between #7/1/2002# And #6/30/2003#) AND (([REQ$_T].MONTH) Is Not Null));
Any ideas on how to specify that I only want those accounts who actually were late?
Table 1: GEN_ED_T
Fields:
FedTaxID 'text field holding tax id number
SubNo1: 'text field holding account number
Table 2: REQ$_T
Fields:
SubNo2: 'text field holding account number
ReqRcvdDate: 'date field holding date report recieved
MONTH: 'Text field holding month of report
Expressions in Query:
DueDate: 'determines the date report was due based on the MONTH field. Reports are due on the 15th of the following month (January's report is due February 15)
LateInDays: ' the number of days late, calculated by subtracting the DueDate from the date received
SELECT GEN_ED_T.FedTaxID, CDate((DateAdd("m",+1,CDate([MONTH] & " 15, " & IIf(DatePart("m",[ReqRcvdDate])<>1,CStr(DatePart("yyyy",[ReqRcvdDate])),CStr(DatePart("yyyy",DateAdd("yyyy",-1,[ReqRcvdDate])))))))) AS DueDate, [REQ$_T].ReqRcvdDate, [REQ$_T].MONTH, [ReqRcvdDate]-[DueDate] AS LateInDays
FROM GEN_ED_T INNER JOIN [REQ$_T] ON GEN_ED_T.SubNo1 = [REQ$_T].SubNo2
WHERE ((([REQ$_T].ReqRcvdDate) Is Not Null And ([REQ$_T].ReqRcvdDate) Between #7/1/2002# And #6/30/2003#) AND (([REQ$_T].MONTH) Is Not Null));
Any ideas on how to specify that I only want those accounts who actually were late?