I have the following piece of code for my query. For some reason some of the records showup with the FileCount field having an error. When I click in the field it says "Data type mismatch in criteria expression." I assume that it is talking about the criteria in the DCount() function. The three fields that are referenced in the criteria portion of the DCount() function are as follows:
The following is the code.
What I don't understand is that about half of the records work and the other half don't. I have checked to make sure that the data in the table is the correct data type. I don't know where to go from here.
Code:
ACHID AutoNumber EffectiveDate Date ACHCompanyID Number
Code:
SELECT tblACHFiles.ACHID,
DCount("*","[tblACHFiles]","[ACHID] <="
& [ACHID]
& " AND Format([EffectiveDate],'yyyymm') ="
& Format([EffectiveDate],'yyyymm')
& " AND [ACHCompanyID] = "
& [ACHCompanyID]) AS FileCount,
Format([EffectiveDate],'yyyymm') AS YearMonth,
tblACHFiles.EffectiveDate
FROM tblACHFiles
WHERE InvoiceID = 105
ORDER BY Month(EffectiveDate),
Day(EffectiveDate);
Comment