calculation with date

Orfeas

Registered User.
Local time
Today, 16:15
Joined
Mar 1, 2005
Messages
11
Hi I need help. I have an update query and I want to calculate total cost.

Total cost equals cost_per_day(curency) times (date_returned - date_hired).
=[copy]![cost_per_day] * ???????

How am I supposed to do that?
 
I guess that you are looking for the DateDiff function to give you the number of days, its in access help.

brian
 
i tried this but it does not giving me a result
 
I thinkmthat you are going to have to give us a bit more info to work with, like your code, but 1st as this is an update query can I ask that you are running it, not just clicking view?

Brian
 
DateDiff("d",Now(),DATE_HIRED)*COPY!COST_PER_DAY

THIS IS INSIDE THE UPDATE TO... BUT I DON'T GET ANYTHING

I AM RUNNING IT...
 
Orfeas said:
DateDiff("d",Now(),DATE_HIRED)*COPY!COST_PER_DAY

THIS IS INSIDE THE UPDATE TO... BUT I DON'T GET ANYTHING

I AM RUNNING IT...

You don't need to shout I am only trying to help.

I knocked up a simple test and mine works, so I am now at a loss, my code did incude the[] round field names, the SQL is below


UPDATE Table1 SET Table1.difference = DateDiff("d",Now(),[date2])*[table1]![cost];

Brian
 
sorry man I had caps lock on by mistake!

Sorry!
 
OK

If you still have no joy perhaps you could post your db or part of it. Got go now back in 30 mins.

the reason i asked about run as oppossed to view is that the update does not rake place for the view it just lists the current field contents.

Brian
 

Users who are viewing this thread

Back
Top Bottom