Minus this Datetime with the field hours in access query

Hi There,
I have two field in access one datetime  field say StartDate like 9/10/2018 7 am and another field in  Hour  say NoHrs example 12 hours
Minus this Datetime with the field  hours in access query so I get something like 9/10/2018 7am - 12 hours  the result to be 9/9/2018 7 PM.
I would appreciate if anybody can let me know how I can do this.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
You want dateAdd()


and also if you want the time between two date fields, you would use DateDiff().

SivasanAuthor Commented:
Hi Jim,
Thank your for your response.
I tried this but instead of getting the desired result in Datetime format, I get the result as 1040815 when I tried

DateDiff("h",-[HoursField],[DateField])  where the value  of Hoursfield is 12 and value of DateField is 9/12/2018 7:00 Am

The datefield is datetime field and Hoursfield is a computed Integer field.
I'm expecting the result in the form 9/11/2018 7:00 Pm for the above values.
Please advise, what I may be doing wrong.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
"DateDiff("h",-[HoursField],[DateField])  where the value  of Hoursfield is 12 and value of DateField is 9/12/2018 7:00 Am "

 You want DateAdd(), not DateDiff():


 DateAdd() is used for adding (or subtracting) an interval from a date.

 DateDiff() is the opposite of what you were looking to do; give me the difference between two dates in whatever interval I choose.   I added that to the comment just in case you needed to go the other way.  Sorry if that caused confusion.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SivasanAuthor Commented:
Awesome. That worked. Thanks a million.....
SivasanAuthor Commented:
Awesome answer...Thanks a million
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.