DateAdd


G

Guest

I'm trying to add 6 months to a client list for year ends. So, if year end is
Dec 31/04, I want the new column to read June 30/05. I've been trying to get
DateAdd to work using the default value =DateAdd("m",6,[Year End]), but no
luck. Please help, I don't want to change all the dates manually!

Thanks in advance!
 
Ad

Advertisements

F

fredg

I'm trying to add 6 months to a client list for year ends. So, if year end is
Dec 31/04, I want the new column to read June 30/05. I've been trying to get
DateAdd to work using the default value =DateAdd("m",6,[Year End]), but no
luck. Please help, I don't want to change all the dates manually!

Thanks in advance!
Where are you doing this.
Since =DateAdd("m",6,[Year End]) is the correct formula (assuming
[Year End] is a valid Date/Time datatype), your "no luck" doesn't
really tell us anything.
Where are you doing this? You mention 'New Column' so I suspect it is
in a query. If so, do not use the = sign:
NewColumn:DateAdd("m",6,[Year End])

What do you get?
You are not trying to save this calculated data in any table are you
(I hope not)?
 
J

John Vinson

I'm trying to add 6 months to a client list for year ends. So, if year end is
Dec 31/04, I want the new column to read June 30/05. I've been trying to get
DateAdd to work using the default value =DateAdd("m",6,[Year End]), but no
luck. Please help, I don't want to change all the dates manually!

Thanks in advance!

Where are you trying to do this? If it's in a Table... don't. This
information can be calculated on the fly and need not - indeed should
not! - be stored in your table. Just use a Query with this same
expression as a calculated field.

John W. Vinson[MVP]
 
G

Guest

I am trying to do it in a table. Is it not possible for the database to
generate the date 6 months in the future within a table?
 
Ad

Advertisements

J

John Vinson

Is it not possible for the database to
generate the date 6 months in the future within a table?

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox.


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top