J
JoJo Sharp via AccessMonster.com
Hi gurus, I have benefited tremendously from reading your postings, more
than from my work or books. Thank you in advance for your help here.
I have two tables: DrVisits and HealthCoverage. I would like to find if a
doctor's visit (tbl: DrVisits) is covered by a plan (tbl: HealthPlan). If
covered, I marked the resulting table as "y"; Otherwise, "n". My query shown
below.
DrVisits
MemID dos
1 5/1/2002
1 6/8/2003
1 12/31/2004
HealthPlan
MemID plan start end
1 HealthNet 1/1/2002 6/1/2002
1 Pacificare 1/1/2003 12/31/2003
1 SecureHorizon 1/1/2005 12/31/9999
My qry: SELECT DrVisits.memID, DrVisits.dos, HealthPlan.plan, IIf(DrVisits!
dos Between HealthPlan!start And HealthPlan!end,"y","n") AS covered
FROM DrVisits LEFT JOIN HealthPlan ON DrVisits.memID = HealthPlan.memID
However, this results is not ideal. See result please:
memID dos plan covered
1 5/1/2002 hp y
1 5/1/2002 pc n
1 5/1/2002 sh n
1 6/8/2003 hp n
1 6/8/2003 pc y
1 6/8/2003 sh n
1 12/31/2004 hp n
1 12/31/2004 pc n
1 12/31/2004 sh n
How can I just do this qry so that I only have three qualified entries:
1 5/1/2002 hp y
1 6/8/2003 pc y
1 12/31/2004 n
than from my work or books. Thank you in advance for your help here.
I have two tables: DrVisits and HealthCoverage. I would like to find if a
doctor's visit (tbl: DrVisits) is covered by a plan (tbl: HealthPlan). If
covered, I marked the resulting table as "y"; Otherwise, "n". My query shown
below.
DrVisits
MemID dos
1 5/1/2002
1 6/8/2003
1 12/31/2004
HealthPlan
MemID plan start end
1 HealthNet 1/1/2002 6/1/2002
1 Pacificare 1/1/2003 12/31/2003
1 SecureHorizon 1/1/2005 12/31/9999
My qry: SELECT DrVisits.memID, DrVisits.dos, HealthPlan.plan, IIf(DrVisits!
dos Between HealthPlan!start And HealthPlan!end,"y","n") AS covered
FROM DrVisits LEFT JOIN HealthPlan ON DrVisits.memID = HealthPlan.memID
However, this results is not ideal. See result please:
memID dos plan covered
1 5/1/2002 hp y
1 5/1/2002 pc n
1 5/1/2002 sh n
1 6/8/2003 hp n
1 6/8/2003 pc y
1 6/8/2003 sh n
1 12/31/2004 hp n
1 12/31/2004 pc n
1 12/31/2004 sh n
How can I just do this qry so that I only have three qualified entries:
1 5/1/2002 hp y
1 6/8/2003 pc y
1 12/31/2004 n