Problem with DateDiff function

stoyan377

New member
Local time
Yesterday, 16:31
Joined
Dec 26, 2013
Messages
4
Hello! I have to make coursework in Access, but I got a problem. So in my courcework, I need to make database about rent a car business. One of the queries have to show the sum which client have to pay. There is a renting tax for each day and for example: One customer rents a car for the period: 13/11/2013 to 16/11/2013. So i have to use DateDiff to count difference between these days. The difference X Cost Per Day = Total Costs. I use DateDiff but with no luck:

Exp1: DateDiff(''d'',[Contract_Date],[Return_Date]

I receive error message that says invalid syntax and select the "d".
I'll appreciate the help! Thanks in advance!
 
If that's a copy/paste, you missed the closing parentheses.
 
Ok, so i type this: Exp1: DateDiff(”d”,[Contract_Date],[Return_Date])
When i run the query, Access adds [] on ”d” and it's like using parameter: Exp1: DateDiff([”d”],[Contract_Date],[Return_Date])
I just want to show me the difference between days. :(
 
This worked fine for me in a query:

Expr1: DateDiff("d",[ReqDateTime],[CallDateTime])
 
This worked fine for me in a query:

Expr1: DateDiff("d",[ReqDateTime],[CallDateTime])

Thanks a lot! It works! The whole problem was my language and region setting in Control Panel. If you switch to US settings, it's working! But when i switch to my country, Access don't like the comma.
 
Last edited:
Happy to help! Must have been those slanted quotes it didn't like.
 
Ah; you can try this with the original country settings:

Expr1: DateDiff("d";[ReqDateTime];[CallDateTime])
 

Users who are viewing this thread

Back
Top Bottom