DateAdd function

R

Ran BD

does anyone knows how to use the date add function ?
I have a reg_date field in a table containing a date
I have another field name Reg_renw_Date that equals to reg_Date + 12 months.
how do I calculate it ?

I'm using access 2002 with sql 2000 on the backend.

thanks
 
V

Van T. Dinh

[Reg_Renw_Date] is a *calculated* value so you not store
it in the Table.

You can *ALWAYS* work it out from [Reg_Date] whenever you
need it so why bothers storing it which:

* wastes storage space.
* introduces inconsistencies into your database
* make your database inefficient (fetching a value is
generally slower than calculations in the memory).

HTH
Van T. Dinh
MVP (Access)
 
S

SFAccess

Even though SQL Server 2000 supports calculated fields,
most database developers recommend not to use this unless
absolutely necessary for the reasons described by Van T.
Dinh.
The syntax for the DateAdd function is as follows:
DateAdd(interval(i.e. "m" for months, "y" for years,
etc),the number which to add(or subtract if negative),the
date expression which is the basis for the computation)
So in your case:
DateAdd("m", 12, [Reg_renw_Date])
 

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