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)