Nz function in query

  • Thread starter trevorC via AccessMonster.com
  • Start date
T

trevorC via AccessMonster.com

Hi All, the query below shows an error if any of the date in / date out
entries in the table are empty.
How can i impiment the Nz function to stop this.

SQL from query...
SELECT Employees.[First Name], Employees.[Last Name], Format([Normal start
Time],"h:nn AMPM") AS ['Normal Start Time], Format([Normal End Time],"h:nn
AMPM") AS ['Normal End Time], Format([scan time in],"h:nn AMPM") AS ['Scan
Time In], Format([scan time Out],"h:mm AMPM") AS ['Scan Time Out], Format(
[Scan Date In],"dddd dd,mm,yyyy") AS ['Scan Date In], Format([Scan Date Out],
"dddd dd,mm,yyyy") AS ['Scan Date Out], Format([Scan Time Out]-[Scan Time in],
"h:nn") AS [Total Hours], Format([Scan Time Out]-[Scan Time in],"h") AS Hours,
Format([Scan Time Out]-[Scan Time in],"nn") AS minutes, (([hours])*60)+nz(
[minutes]) AS [Total Minutes]
FROM Employees RIGHT JOIN [Time Tracking] ON Employees.Barcode = [Time
Tracking].[Employee ID]
ORDER BY Employees.[Last Name], [Time Tracking].[Scan Date Out];

This is the line that causes the error, were & how do i incorporate the Nz
function into it.
(([hours])*60)+nz([minutes])

The formatting in the query is so that i can export directly to Excel and the
fields are ready to see formatted and perform other calculations from there.

Any help would be great thanks.
 
J

Jeanette Cunningham

Try something like this

((Nz([hours],0)*60)+nz([minutes],0)


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
T

trevorC via AccessMonster.com

Thanks for the reply, this helped me sort out my problem. Then i realised
that it doesnt matter what the result is i still have go into Excel and code
there as well to sort out missing Scans in or out and provide a clean output
to those above.

Jeanette said:
Try something like this

((Nz([hours],0)*60)+nz([minutes],0)

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Hi All, the query below shows an error if any of the date in / date out
entries in the table are empty.
[quoted text clipped - 27 lines]
Any help would be great 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

Top