Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate DateDiff between two different records 1

Status
Not open for further replies.

Debbie37

Technical User
Joined
Feb 23, 2002
Messages
28
Location
US
The main form is patient admission info and the subform tracks ventilator data. Two date fields, [DateOnVent] and [DateWean], contain one ventilator record. However, when/if the patient returns to vent support I need to calculate days weaned (date returning to vent support [DateOnVent]new vent record-minus- the last date weaned [DateWean] previous vent record). A patient may have several vent records during one admission. Any ideas on how to calculate between two records would recieve my enduring gratitude :)
 
Are you familiar with SubQueries? If so, this is perhaps the easiest approach. Otherwise, it can be done in code, but it will be somewhat convolouted.

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
i created a table with these fields
client 'client number
sdate 'start date
edate ' enddate
in the query i added
nextstart 'the next start date for this client
timeelsaped 'the time elasped between ending date and next date
SELECT dates.client, dates.sdate, dates.edate, DMin("sdate","dates"," sdate>#" & [dates].[edate] & "#and client=" & [dates].[client]) AS nextstart, DateDiff("d",[edate],[nextstart]) AS timeelsaped
FROM dates
WHERE (((dates.client)=1));
 
Thank you pwise, it works like a charm!!! I gave you a star for the simplicity of the solution :) Super-fantastic!

Thanks tons....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top