how to calculate the number of person

  • Thread starter Thread starter littleskinny83
  • Start date Start date
L

littleskinny83

I want to ask how to calculate the number of patient based on the
time.
Time of seeing doctor - Time of registration=waiting time
No of patient waiting less than 90 min.
total number patient for the month.
 
It would be helpful if you could tell us what your table structure looks like.


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
I want to ask how to calculate the number of patient based on the
time.
Time of seeing doctor - Time of registration=waiting time
No of patient waiting less than 90 min.
total number patient for the month.

Use an appropriate Totals Query with appropriate criteria, using the
DateDiff() function to calculate the waiting time.

Since we have no way to know anything about the structure of your table,
you'll have to help us if you want to find out what's "appropriate".
 
It would be helpful if you could tell us what your table structure looks like.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.





- Show quoted text -

This is the table of patient and the appointment.

Table Patient
Rn
Name
Id
Dob
Address
Phone No
Status of Death

Table Appointment
Id
Date of registration
Time of registration
Time of seeing doctor
Waiting time
 
This is the table of patient and the appointment.

Table Patient
Rn
Name
Id
Dob
Address
Phone No
Status of Death

Table Appointment
Id
Date of registration
Time of registration
Time of seeing doctor
Waiting time

The Waiting Time field should *simply not exist* in your table. Instead, just
store the time of registration and the time of seeing doctor, and calculate
the waiting time dynamically with a query calculated field:

WaitingTime: DateDiff("n", NZ([Time of Registration], Time()), NZ([Time of
Seeing Doctor], Now()))

This will calculate how long the patient waited if there is information
available in both fields, and how long they've been waiting up until the
present moment if there is nothing in [time of seeing doctor]. Just use the
fieldnames rather than the NZ() function call if there will alsways be data.

You can nest this function inside an IIF to count the patients with various
waiting times. This query should work:

SELECT Count(*) AS NumberofPatients, Sum(IIF(DateDiff("n", [Time of
Registration], [Time of Seeing Doctor]) < 90, 1, 0) AS Under90Minutes
FROM [Table Appointment]
WHERE [Date of Registration] >= DateSerial(Year([Enter a date in desired
month:]), Month([Enter a date in desired month:]),1) AND [Date of
Registration] < DateSerial(Year([Enter a date in desired month:]),
Month([Enter a date in desired month:]) + 1,1);

--

John W. Vinson [MVP]
Does [Table Appointment] have a primary key? If not, it needs one.
I would recommend that you NOT use blanks in fieldnames - it's legal but can
cause hassles later on.
 
This is the table of patient and the appointment.
Table Patient
Rn
Name
Id
Dob
Address
Phone No
Status of Death
Table Appointment
Id
Date of registration
Time of registration
Time of seeing doctor
Waiting time

The Waiting Time field should *simply not exist* in your table. Instead, just
store the time of registration and the time of seeing doctor, and calculate
the waiting time dynamically with a query calculated field:

WaitingTime: DateDiff("n", NZ([Time of Registration], Time()), NZ([Time of
Seeing Doctor], Now()))

This will calculate how long the patient waited if there is information
available in both fields, and how long they've been waiting up until the
present moment if there is nothing in [time of seeing doctor]. Just use the
fieldnames rather than the NZ() function call if there will alsways be data.

You can nest this function inside an IIF to count the patients with various
waiting times. This query should work:

SELECT Count(*) AS NumberofPatients, Sum(IIF(DateDiff("n", [Time of
Registration], [Time of Seeing Doctor]) < 90, 1, 0) AS Under90Minutes
FROM [Table Appointment]
WHERE [Date of Registration] >= DateSerial(Year([Enter a date in desired
month:]), Month([Enter a date in desired month:]),1) AND [Date of
Registration] < DateSerial(Year([Enter a date in desired month:]),
Month([Enter a date in desired month:]) + 1,1);

--

             John W. Vinson [MVP]
Does [Table Appointment] have a primary key? If not, it needs one.
I would recommend that you NOT use blanks in fieldnames - it's legal but can
cause hassles later on.- Hide quoted text -

- Show quoted text -

Thanks.Its worked..
 
Back
Top