#Func! Calculating difference between times (1 Viewer)

guinness

Registered User.
Local time
Today, 09:45
Joined
Mar 15, 2011
Messages
249
Hi all,

I'm returning to access after quite some time and discovering that I have forgotten how to do even basic stuff. I am starting to create a resourcing database that needs to be able to work with dates and times and perform calculations on them.

I need to work out the number of hours. I have two date/time fields Day_Start_Time and Day_End_Time. I want to calculate the difference between the two in hours and then multiply by the number of working days. I tried this: Number_Of_Hours: DateDiff("hh",[Day_Start_Time],[Day_End_Time])*[Number_of_days] but get #Func! when I run the query.

I'm probably missing something very basic (like a knowledge of Access) but can anyone help?

Thanks in advance

Kev
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 12:45
Joined
Jan 23, 2006
Messages
15,379
See this for syntax and examples of DateDiff().

What exactly does the *[Number_of_days], mean?
 

guinness

Registered User.
Local time
Today, 09:45
Joined
Mar 15, 2011
Messages
249
Number_of_days is the amount of working days (took ages to get that to work, ended up copying someone elses VBA code without any real idea how 0or why it worked). So I had a start time and an end time to give me an amount of hours per day then multiplied by the amount of working days.

I got the code sorted Number_Of_Hours: DateDiff("h",[Day_Start_Time],[Day_End_Time])*[Work Days]

I had an extra "h"

Thanks again
 

jdraw

Super Moderator
Staff member
Local time
Today, 12:45
Joined
Jan 23, 2006
Messages
15,379
Glad you have it working.
 

Users who are viewing this thread

Top Bottom