datediff calculation on Access Form

  • Thread starter Thread starter p-rat
  • Start date Start date
P

p-rat

i have this query on my back end SQL that runs fine:

CONVERT(MONEY,(DATEDIFF(N,StartTime,EndTime)/15)/4.0)

i'm wanting to put this calculation in a textbox on my form that when
the user enters in the StartTime and EndTime it places the correct
value in the textbox.

i'm getting error after error and can't figure out what I'm doing
wrong.

help. thanks.
 
Can you post the exact error(s) you are getting?

From the syntax you posted, CONVERT(MONEY...) might be trying to use custom
function. I'm not terribly conversant in JET functions, but the syntax makes
me think it might be custom.
 
i have this query on my back end SQL that runs fine:

CONVERT(MONEY,(DATEDIFF(N,StartTime,EndTime)/15)/4.0)

i'm wanting to put this calculation in a textbox on my form that when
the user enters in the StartTime and EndTime it places the correct
value in the textbox.

i'm getting error after error and can't figure out what I'm doing
wrong.

help. thanks.

You seem to be mixing T-SQL with native Access code. The Access expression for
this would be

CCur(DateDiff("n", [StartTime], [EndTime])/15)/4.0

or simply divide by 60 rather than doing it in two steps.

This assumes that you want to calculate the number of minutes between the two
times, divide that result by 15, convert that fraction to currency, and then
divide that value by 4.
 

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