I'm assuming that one of the fields will track the date and time the patient
arrived. Also this field will be a data/time datatype. In that case create a
query and have the following criteria in the date field.
Between [Report Start Date] and [Report End Date] +.99999
Base the report on this query. When run the query or report will ask you for
the dates that you want. One problem might be that the query might be
expecting the mm/dd/yy date format.

Signature
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
> Hi,
>
[quoted text clipped - 9 lines]
>
> Thanks
davem - 29 May 2007 11:59 GMT
Hi Jerry,
I'm not sure what the ".99999" section of the expression is doing but when I
entered this into with the rest of the expressions into the criteria box it
returns an error (expression typed incorrectly or too complicated to
evaluate....).
I have a field in my table that is a unique patient identifier (Patient
Number) and also one for 'diagnosis'. I want to query for the last week gone
(each week), but if the patient number exist already in the table with the
same diagnosis (but for a different date not included in the range entered) I
want to exclude this from what my query returns.
Thanks.

Signature
Dave Morris
> I'm assuming that one of the fields will track the date and time the patient
> arrived. Also this field will be a data/time datatype. In that case create a
[quoted text clipped - 19 lines]
> >
> > Thanks
>Hi,
>
[quoted text clipped - 9 lines]
>
>Thanks
I'd strongly suggest having *two* tables - a table of Patients (which will be
relatively static) related one-to-many to a table of visits. You can then
easily use a Query to select only those visits within a certain range of
dates.
It's not at all clear from your post how your table is structured, or what is
being "refreshed" or updated.
John W. Vinson [MVP]
> Hi,
>
[quoted text clipped - 9 lines]
>
> Thanks
Last week's appointments, but not those with diagnosis from a previous
week.
(not tested)
Assumes table Patients (patient_id, first_name, last_name)
and table PatientAppointments (patient_id, appt_date, diagnosis)
Query1:
SELECT patients.patient_id,
patients.first_name,
patients.last_name,
patientappointments.appt_date,
patientappointments.diagnosis
FROM patients
INNER JOIN patientappointments
ON patients.patient_id = patientappointments.patient_id;
SELECT a.patient_id,
a.first_name,
a.last_name,
a.diagnosis,
a.appt_date
FROM query1 AS a
WHERE a.appt_date BETWEEN (DATE() - DATEPART("w",DATE()) + 1) - 7
AND (DATE() - DATEPART("w",DATE()) + 1) - 1
AND a.patient_id NOT IN (SELECT b.patient_id
FROM query1 AS b
WHERE a.patient_id = b.patient_id
AND a.diagnosis = b.diagnosis
AND b.appt_date < (DATE() - DATEPART
("w",DATE()) + 1) - 7);
dave - 29 May 2007 21:49 GMT
Michael,
in you reply, you included this as the last line of code - ("w",DATE()) +
1) - 7);
I am just begining to use Access but so far have delt w/ Excel mostly. Can
you help me out and explain what this code systax is. I understand what it
does (last weeks search) but what does the "w" do and why not just subtract 6
days vs. +1 -7?
thanks for the help
dave
> > Hi,
> >
[quoted text clipped - 42 lines]
> AND b.appt_date < (DATE() - DATEPART
> ("w",DATE()) + 1) - 7);
Michael Gramelspacher - 29 May 2007 22:46 GMT
> Michael,
> in you reply, you included this as the last line of code - ("w",DATE()) +
[quoted text clipped - 41 lines]
> > SELECT a.patient_id,
> > a.first_name,
Open an Access database and press Ctrl-G,
then copy the following into the Immediate window.
?(DATE() - DATEPART("w",DATE()) + 1) - 7
5/20/2007
?(DATE() - DATEPART("w",DATE()) + 1) - 1
5/26/2007
?(DATE() - DATEPART("w",DATE()) + 1)
5/27/2007
put your cursor at the end of any of the expression
and press Enter. You dates should be the same as mine.
5/20/2007 is beginning of last week
5/26/2007 is end of last week
5/27/2007 is start of this week