Date Calculator

  • Thread starter Thread starter Olduke
  • Start date Start date
O

Olduke

Will said:
Can someone point me to some Visual Basic or Access functions that would do
calculations on dates? Given as input the date and some number of days
before that date, I want as output the correct adjusted calendar date (e.g.,
2/2/2008 minus 3 days = 1/30/2008).

--

I'm a little rusty on this so if the code is wrong, perhaps someone will
correct it.

In the calculated date field add the following code:

=DateAdd("d" -3,[OriginalDateField])
 
You can use the DateAdd function for that:

dtmNewDate = DateAdd("d", -3, Me.InputDate)

If you need something more sophisticated that will not include week ends or
holidays, post back and I can send you a function that will do that.
 
Can someone point me to some Visual Basic or Access functions that would do
calculations on dates? Given as input the date and some number of days
before that date, I want as output the correct adjusted calendar date (e.g.,
2/2/2008 minus 3 days = 1/30/2008).
 
Can someone point me to some Visual Basic or Access functions that would do
calculations on dates? Given as input the date and some number of days
before that date, I want as output the correct adjusted calendar date (e.g.,
2/2/2008 minus 3 days = 1/30/2008).

In addition to the other DateAdd function, how about
=[DateField]-3
 
That works, but I prefer always using date functions when dealing with date
data types. It isn't required, but It is just my preference. It is sort of
like always qualifying controls with Me. or Me! It still works, but IMHO,
just good policy.
--
Dave Hargis, Microsoft Access MVP


fredg said:
Can someone point me to some Visual Basic or Access functions that would do
calculations on dates? Given as input the date and some number of days
before that date, I want as output the correct adjusted calendar date (e.g.,
2/2/2008 minus 3 days = 1/30/2008).

In addition to the other DateAdd function, how about
=[DateField]-3
 
And, of course, [DateField]-3 ONLY works for days, while the OP asked for
someone to

"point me to some Visual Basic or Access functions that would do calculations
on dates"

DateAdd() works with ALL components of Date/Time fields.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Back
Top