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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

max datediff in a While loop

Status
Not open for further replies.

sbbrown9924

Technical User
Mar 7, 2003
80
US
I am looking for the maximum date interval of
datediff("n", objRS("TriageTime"), objRS("InRoomTime"))
in a "While Not objRS.EOF" loop.

I tried this:

if datediff("n", objRS("TriageTime"), objRS("InRoomTime")) > MaxWaitingTime then MaxWaitingTime=datediff("n", objRS("TriageTime"), objRS("InRoomTime"))
end if

This is probably quite basic. Any help would be appreciated. Thanks.

 
Try this which shows the idea behind if there are further complications on the data format from the rs.

[tt]if datediff("n",[red]cdate([/red]objRS("TriageTime")[red])[/red],[red]cdate([/red]objRS("InRoomTime")[red])[/red]) > MaxWaitingTime then
MaxWaitingTime=datediff("n",[red]cdate([/red]objRS("TriageTime")[red])[/red],[red]cdate([/red]objRS("InRoomTime")[red])[/red])
end if
[/tt]
Note: if what you show is all on one line, then you don't need "end if".
 
Tsuji - thanks for your help, you gave me a little gem of information that helped me figure this out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top