Null run-time error

M

Mark

Hi all,

I have a database that I am trying to work on. I have a
report that lists multiple employees with their
corresponding breakouts/details of work progress. And
report totals for each employee. My problem is that when
I run the report I am getting: Run-time error 94, Invalid
use of Null. I believe this is because one employee has
records with 0 and the total column is showing "error".
So, I am thinking that the problem lies with me trying to
total up the detail records and when the total equals zero
or null (not sure which is the case) I am getting this
error message asking to debug. Below is some more
information. If anyone could point me in a good direction
I would sure appreciate it very much. I have tried a few
things to the below fields/code like using "_" and taking
out the Null.


fields:
[BTAddlInfo] = Format is Yes/No (Yes = -1, No = 0)
[DeptRecd] = Format is General Date
[BTTriageTime] = Format is Short Time (Date/Time)


Report - text box control source:

=ElapsedTime(Avg(IIf([BTAddlInfo]=0,[DeptRecd]-
[BTTriageTime],Null)))


Function -

Function ElapsedTime(Interval)
ElapsedTime = Int(CSng(Interval)) & ":" & Format
(Interval, "hh") & ":" & Format(Interval, "nn")
End Function


Thanks!!!
 
B

Brendan Reynolds

The CSng() function, which is called by your 'ElapsedTime' function, can not
accept a Null value. So you need to check for a Null value before attempting
to use CSng(). Something like ...

Function ElapsedTime(Interval)

If IsNull(Interval) Then
ElapsedTime = Null
Else
ElapsedTime = Int(CSng(Interval)) & ":" & Format(Interval, "hh") &
":" & Format(Interval, "nn")
End If

End Function
 
M

Mark

Hey, Thanks for the correct fix!!! I cannot believe you
were able to figure out all of my babble so quickly.
THANKS A BUNCH!!!!!

-----Original Message-----
The CSng() function, which is called by
your 'ElapsedTime' function, can not
accept a Null value. So you need to check for a Null value before attempting
to use CSng(). Something like ...

Function ElapsedTime(Interval)

If IsNull(Interval) Then
ElapsedTime = Null
Else
ElapsedTime = Int(CSng(Interval)) & ":" & Format (Interval, "hh") &
":" & Format(Interval, "nn")
End If

End Function

--
Brendan Reynolds (MVP)
Hi all,

I have a database that I am trying to work on. I have a
report that lists multiple employees with their
corresponding breakouts/details of work progress. And
report totals for each employee. My problem is that when
I run the report I am getting: Run-time error 94, Invalid
use of Null. I believe this is because one employee has
records with 0 and the total column is showing "error".
So, I am thinking that the problem lies with me trying to
total up the detail records and when the total equals zero
or null (not sure which is the case) I am getting this
error message asking to debug. Below is some more
information. If anyone could point me in a good direction
I would sure appreciate it very much. I have tried a few
things to the below fields/code like using "_" and taking
out the Null.


fields:
[BTAddlInfo] = Format is Yes/No (Yes = -1, No = 0)
[DeptRecd] = Format is General Date
[BTTriageTime] = Format is Short Time (Date/Time)


Report - text box control source:

=ElapsedTime(Avg(IIf([BTAddlInfo]=0,[DeptRecd]-
[BTTriageTime],Null)))


Function -

Function ElapsedTime(Interval)
ElapsedTime = Int(CSng(Interval)) & ":" & Format
(Interval, "hh") & ":" & Format(Interval, "nn")
End Function


Thanks!!!


.
 
B

Brendan Reynolds

You're very welcome, Mark! :)

--
Brendan Reynolds (MVP)

Mark said:
Hey, Thanks for the correct fix!!! I cannot believe you
were able to figure out all of my babble so quickly.
THANKS A BUNCH!!!!!

-----Original Message-----
The CSng() function, which is called by
your 'ElapsedTime' function, can not
accept a Null value. So you need to check for a Null value before attempting
to use CSng(). Something like ...

Function ElapsedTime(Interval)

If IsNull(Interval) Then
ElapsedTime = Null
Else
ElapsedTime = Int(CSng(Interval)) & ":" & Format (Interval, "hh") &
":" & Format(Interval, "nn")
End If

End Function

--
Brendan Reynolds (MVP)
Hi all,

I have a database that I am trying to work on. I have a
report that lists multiple employees with their
corresponding breakouts/details of work progress. And
report totals for each employee. My problem is that when
I run the report I am getting: Run-time error 94, Invalid
use of Null. I believe this is because one employee has
records with 0 and the total column is showing "error".
So, I am thinking that the problem lies with me trying to
total up the detail records and when the total equals zero
or null (not sure which is the case) I am getting this
error message asking to debug. Below is some more
information. If anyone could point me in a good direction
I would sure appreciate it very much. I have tried a few
things to the below fields/code like using "_" and taking
out the Null.


fields:
[BTAddlInfo] = Format is Yes/No (Yes = -1, No = 0)
[DeptRecd] = Format is General Date
[BTTriageTime] = Format is Short Time (Date/Time)


Report - text box control source:

=ElapsedTime(Avg(IIf([BTAddlInfo]=0,[DeptRecd]-
[BTTriageTime],Null)))


Function -

Function ElapsedTime(Interval)
ElapsedTime = Int(CSng(Interval)) & ":" & Format
(Interval, "hh") & ":" & Format(Interval, "nn")
End Function


Thanks!!!


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top