#ERROR Message

G

Guest

I have code in a report text box that works great.
Just one problem, If the field or fields is missing or doesn't have data the
function will display and annoying "#Error" message. How can I just display a
blank or "N/A" Message instead. Thanks all

diff2dates("hn",CDate([rec Dte] & " " & [rec time]),CDate(Date() & " " &
Time()))
 
J

John Spencer

Test to see if the field or fields is null

IIF(IsNull([Rec Dte]),"N/A", diff2dates("hn",CDate([rec Dte] & " " & [rec
time]),CDate(Date() & " " & Time())))

If you need to check both then
IIF(IsNull([Rec Dte]) or IsNull([rec time]), ...,...)
 
G

Guest

This works fine if Rec dte or Rec dte are blank, but #Error appears if no
records meet the query. How do I control the message when no records are
found for this query in the report? Thanks for your help Mr. Spencer

John Spencer said:
Test to see if the field or fields is null

IIF(IsNull([Rec Dte]),"N/A", diff2dates("hn",CDate([rec Dte] & " " & [rec
time]),CDate(Date() & " " & Time())))

If you need to check both then
IIF(IsNull([Rec Dte]) or IsNull([rec time]), ...,...)

bladelock said:
I have code in a report text box that works great.
Just one problem, If the field or fields is missing or doesn't have data
the
function will display and annoying "#Error" message. How can I just
display a
blank or "N/A" Message instead. Thanks all

diff2dates("hn",CDate([rec Dte] & " " & [rec time]),CDate(Date() & " " &
Time()))
 

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

Top