Why would this query give #Error values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello ....

I am running the following query:

SELECT a.Area, a.Day, Nz(b.DayTime,0) AS DayHours
FROM AllDates AS a LEFT JOIN DayTimeHours AS b ON (a.Area = b.Area) AND
(a.Day = b.Day)
ORDER BY a.Area, a.Day;

The majority of records are fine, but those records in AllDates where there
are no corresponding records in DayTimeHours getting a #Error instead of a 0
in the DayHours column. Is it the "a.Day=b.Day" that is causing problems, or
else might I have I gone wrong?

Thanks.
 
May be a problem with a data type mismatch from the Nz function. What is the
data type of the DayTime field in the DayTimeHours table?
 
The DayTime field is part of a query and comes from an End (Date/Time format)
- Start (Date/Time format) calculation.
 
I changed from the Nz function to an Iif one and it seems to be working now.

Thanks
 
OK.

--

Ken Snell
<MS ACCESS MVP>

Matthew P said:
I changed from the Nz function to an Iif one and it seems to be working
now.

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

Back
Top