I removed the iif statements from the query and it ran without errors
Here is the code after I removed the iif statements
SELECT DISTINCT ALLGHIUTILIZATIONRPTS.Year, ALLGHIUTILIZATIONRPTS.Month, Format([ALLGHIUTILIZATIONRPTS]![CERT-ID],"000000000") AS SSN, ALLGHIUTILIZATIONRPTS.[PATIENT-NAME]...