Remedy Tickets is the name of the table. Name of the query is Turnover Day
and name of report in which I am receiving #error is Turnover report. [Time
Diference]
column is a calculated field that uses a function ElapsedTimeString(),
Function looks like this and displays diffrence between two day in format XX
hours, XX minutes, XX seconds
Public Function ElapsedTimeString(Date1 As Date, _
Date2 As Date) _
As String
'*************************************************************
' Function ElapsedTimeString(Date1 As Date,
' Date2 As Date) As String
' Returns the time elapsed between a starting Date/Time and
' an ending Date/Time formatted as a string that looks like
' this:
' "10 days, 20 hours, 30 minutes, 40 seconds".
'*************************************************************
Dim Interval As Double, str As String, days As Variant
Dim hours As String, minutes As String, seconds As String
If IsNull(Date1) = True Or _
IsNull(Date2) = True Then Exit Function
Interval = Date2 - Date1
days = Fix(CSng(Interval))
hours = Format(Interval, "h")
minutes = Format(Interval, "n")
seconds = Format(Interval, "s")
' Days part of the string
str = IIf(days = 0, "", _
IIf(days = 1, days & " Day", days & " Days"))
str = str & IIf(days = 0, "", _
IIf(hours & minutes & seconds <> "000", ", ", " "))
' Hours part of the string
str = str & IIf(hours = "0", "", _
IIf(hours = "1", hours & " Hour", hours & " Hours"))
str = str & IIf(hours = "0", "", _
IIf(minutes & seconds <> "00", ", ", " "))
' Minutes part of the string
str = str & IIf(minutes = "0", "", _
IIf(minutes = "1", minutes & " Minute", _
minutes & " Minutes"))
str = str & IIf(minutes = "0", "", _
IIf(seconds <> "0", ", ", " "))
'Seconds part of the string
str = str & IIf(seconds = "0", "", _
IIf(seconds = "1", seconds & " Second", _
seconds & " Seconds"))
ElapsedTimeString = IIf(str = "", "0", str)
End Function
Steve Schapel said:
Sorry, Greg, I'm afraid you've lost me there. What it sounds loke to me
is that [Remedy Tickets] is a query. Is that right? And the [Remedy
Tickets] query is based on another query? Or else the [Time Diference]
column is a calculated field that uses a function ElapsedTimeString(),
is that right? I think this must be a custom function, which I am not
familiar with. But it sounds like you will either need to edit the code
for this function, in order to cater to null fields being used as
arguments in the function. Or else alter the way the function is being
used.
--
Steve Schapel, Microsoft Access MVP
SELECT [Remedy Tickets].[Ticket #], [Remedy Tickets].[Ticket Description],
[Remedy Tickets].[Assigned To], [Remedy Tickets].[Open Date], [Remedy
Tickets].Status, [Remedy Tickets].[#Groups], [Remedy Tickets].[Client
Impact], [Remedy Tickets].[Time Closed], [Remedy Tickets].[Time Diference]
FROM [Remedy Tickets]
ORDER BY [Remedy Tickets].[Ticket #] DESC;
# error is in field [Time Difference] because tickets in open, assign and
pending status don't have closure time. Time difference is calculated by
subtracting [Time Closed]-[Open Date]. [Time Closed] and [Open Date] are in
general date format and I am using function =ElapsedTimeString([Open
Date],[Time Closed]) in control source of [Time Difference] Like I
mentioned before [Time Difference] is empty since there is no closure time
and I would like to replace #Error with text “Still open issueâ€