Multiple Calculations Help!!!! you are my Only Hope

Danin

New member
Local time
Tomorrow, 09:48
Joined
Nov 20, 2016
Messages
6
I have been searching all weekend and running out of time. it is final part to the puzzle and I am so over it. head is hurting and tired.
I have a form. it needs to have a total quantity and total cost
Start
Breaks
End
I need to do following but expression hates my formula.
Datediff("n",[DocketTable].[Start]-[DocketTable].[Break]-[DocketTable].[End])/60

It works if i only use 2 fields
Datediff("n",[DocketTable].[Start],[DocketTable.[End])/60

help i need this and am unable to see a solution. i am so over it. but it is frustrating me that i can't see where i am going wrong. please someone take pity on me and help.
:eek:
 
If you give us a clearer description of what you want to accomplish maybe we could help.
 
i need an expression in a form to get times worked in a day minus breaks.

the fields are eg:
Start 06:00
Break 0:45
End 18:00

I need to do following in expression. for a form cell.
Start-Break-End/60 = Total Quantity
eg:

Datediff("n",[Start],[End]/60 but how do i incorporate the Break deduction.
 
Try the below
Code:
(DateDiff("n",[Start],[End])-45)/60
 
Or, using the Break Field, instead of hard coding it with 45:

Code:
=(DateDiff("n", [Start],[End]) - [Break]) / 60

This assumes that Break is defined as a Numbers Datatype, i.e. you're entering the number of minutes taken for a break.

Also note that End is a Reserved Word, in Access, and if this is the actual name of your Field, you need to change that to something else, or it's liable to produce unexpected results, somewhere down the road!

Linq ;0)>
 
Last edited:
Or, using the Break Field, instead of hard coding it with 45:

Code:
=(DateDiff("n", [Start,[End]) - [Break]) / 60
You're missing the "]".
Code:
=(DateDiff("n", [Start[COLOR=Red]][/COLOR],[End]) - [Break]) / 60
 
:o Thanks for catching that! I was using different Field names and accidentally erased the bracket when changing them to the OP's names!

Corrected now!

Linq ;0)>
 
I was missing the parenthesis before the Datediff. How simple was that to solve. I had been trying that bloody code exactly as you wrote it but it wasn't working and I never thought to surround the DateDiff with rounded brackets.
I didn't use End in Table, I couldn't be bothered writing "completion"...lol
Disagree with putting it to number. I have Total Quantity translated to number but start break and finish are fine to stay as short time with my coding.

you both deserve double thumbs up. Thank you so much for the answer. made my day. I promise no more StarWars References, more of a trek fan. Live long and prosper. :)
 

Users who are viewing this thread

Back
Top Bottom