Hi Everyone,
I need some help with an error I'm receiving when I try to setup a relation between the results of a IIf statement and a table.
The IIf statement produces result codes is here:
but when I try to use a table that contains the descriptions to the codes I get a "Type mismatch in expression"
How can I use the codes in the IIf statements to display the description field in the table.
Code that contains the IIf statement:
Here is the code that I used to add the table but it produces the error message:
The result should include the other data as well as the descriptions to the codes.
I created a table with the matching codes and descriptions and it looks like this:
ID, discrepancy_code, discrepancy_description
1, 1, Member inactive. Claim should not be paid.
2, 2, Member inactive. Claim should not be partial paid.
3, 3, Member inactive terminated prior to DOS. Claim should not be paid.
4, 4, Member inactive terminated prior to DOS. Claim should not be partial paid.
Any help would be appreciated.
Thank you,
Rich
I need some help with an error I'm receiving when I try to setup a relation between the results of a IIf statement and a table.
The IIf statement produces result codes is here:
Code:
DISCREPANCY CODE: IIf([STATUS]="I" And [CLAIM STATUS]="PAID CLAIM","1",IIf([STATUS]="I" And [CLAIM STATUS]="PARTIAL PAID","2",IIf([STATUS]="I" And [DOS]>[TERM DATE] And [CLAIM STATUS]="PAID CLAIM","3",IIf([STATUS]="I" And [DOS]>[TERM DATE] And [CLAIM STATUS]="PARTIAL PAID","4",""))))
How can I use the codes in the IIf statements to display the description field in the table.
Code that contains the IIf statement:
Code:
SELECT DISTINCT ALLGHIUTILIZATIONRPTS.Year, ALLGHIUTILIZATIONRPTS.Month, Format([ALLGHIUTILIZATIONRPTS]![CERT-ID],"000000000") AS SSN, ALLGHIUTILIZATIONRPTS.[PATIENT-NAME] AS [MEMBER NAME], codes_coverage.cov_type AS [COV CODE], ALLGHIUTILIZATIONRPTS.[BIRTH DATE], ALLGHIUTILIZATIONRPTS.REL AS RELATION, ALLGHIUTILIZATIONRPTS.INCUR AS DOS, dbo_elg205.ps_welfare_status AS STATUS, dbo_elg205.ps_term_date AS [TERM DATE], ALLGHIUTILIZATIONRPTS.[CLAIM STATUS], IIf([STATUS]="I" And [CLAIM STATUS]="PAID CLAIM","1",IIf([STATUS]="I" And [CLAIM STATUS]="PARTIAL PAID","2",IIf([STATUS]="I" And [DOS]>[TERM DATE] And [CLAIM STATUS]="PAID CLAIM","3",IIf([STATUS]="I" And [DOS]>[TERM DATE] And [CLAIM STATUS]="PARTIAL PAID","4","")))) AS [DISCREPANCY CODE]
FROM codes_coverage INNER JOIN ((ALLGHIUTILIZATIONRPTS INNER JOIN qryMostRecentDate ON (ALLGHIUTILIZATIONRPTS.[CERT-ID] = qryMostRecentDate.[CERT-ID]) AND (ALLGHIUTILIZATIONRPTS.[INCUR] = qryMostRecentDate.[INCUR])) INNER JOIN dbo_elg205 ON (qryMostRecentDate.[CERT-ID] = dbo_elg205.[ps_ss_nbr]) AND (qryMostRecentDate.[MaxVanSTATUS DATE] = dbo_elg205.[ps_date])) ON codes_coverage.[cov_code] = dbo_elg205.[ps_cov_type]
WHERE (((ALLGHIUTILIZATIONRPTS.Year)=[Enter Year]) AND ((ALLGHIUTILIZATIONRPTS.Month)=[Enter Month]) AND ((ALLGHIUTILIZATIONRPTS.REL)="M"));
Code:
SELECT qryGHIMBRUTILIZATIONRPT.*, tblGHI_DISCREPANCY_CODES.discrepancy_description
FROM tblGHI_DISCREPANCY_CODES INNER JOIN qryGHIMBRUTILIZATIONRPT ON tblGHI_DISCREPANCY_CODES.discrepancy_code = qryGHIMBRUTILIZATIONRPT.[DISCREPANCY CODE];
I created a table with the matching codes and descriptions and it looks like this:
ID, discrepancy_code, discrepancy_description
1, 1, Member inactive. Claim should not be paid.
2, 2, Member inactive. Claim should not be partial paid.
3, 3, Member inactive terminated prior to DOS. Claim should not be paid.
4, 4, Member inactive terminated prior to DOS. Claim should not be partial paid.
Any help would be appreciated.
Thank you,
Rich