How do I set Up Calcuating A future date in Access?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to set up Calcuating A future date in an Access Data Base and
need assistance. When I follow the steps in the Microsoft Office Assistance I
get 06/30/1900 no matter what date i use as a start date.
 
You would have to tell us what you want to accomplish before we can tell you
how to do it.

Are you in a form? Query? Report? What is the base date you want to use,
and how many days/weeks/months/years do you wish to add to it?
 
I am trying to set up Calcuating A future date in an Access Data Base and
need assistance. When I follow the steps in the Microsoft Office Assistance I
get 06/30/1900 no matter what date i use as a start date.

And the steps in Microsoft Office Assistance are?
And your exact expression is?
And an example of what you want to do is?

Did you enter Date in the VBA Help Index and look at the various Date
functions listed?
Help us help you.
 
Michael said:
I am trying to set up Calcuating A future date in an Access Data Base and
need assistance. When I follow the steps in the Microsoft Office Assistance I
get 06/30/1900 no matter what date i use as a start date.

It looks like you are trying:

DateAdd("m", 6, dtMyDate)

with dtMyDate Dim'ed as a Date.

I tried using that expression when the value of dtMyDate is 0 or
uninitialized and got 6/30/1900 both ways.

Here are some examples of assigning a date in VBA:

dtMyDate = #3/16/06#
dtMyDate = DateSerial(2006, 3, 16)
dtMyDate = CDate("3/16/06")
dtMyDate = CDate("March 16, 2006")
dtSixMonthsFromToday = DateAdd("m", 6, Date()) 'See if VBA strips Date's
parentheses

Then:

dtSixMonthsFromMyDate = DateAdd("m", 6, dtMyDate)

For a query, use a date field's name or use an expression that evaluates
to a date. Try one of the following within the Field: box in the QBE
query design view:

SixMonthsFromMyDate: DateAdd("m", 6, [MyDateField])

or

SixMonthsFromToday: DateAdd('m', 6, Date())

or

SixMonthsFromMyDate: IIf([MyDateField] IS NOT Null,
DateAdd("m",6,[MyDateField]), Null)

Be sure to replace [MyDateField] with the actual name of the date field
you are using.

James A. Fortune
(e-mail address removed)
 
Back
Top