How do I make one date field automatically add 2 weeks to...

R

RYANneedsHELP

I have two date fields...I want the second date field to automatically add a
date 2 weeks to the date that is in the first date field?

So... the user would only have to type in one date field and the second
would automatically show the future (2 weeks) date?

Any ideas?

Thanks.
 
F

fredg

I have two date fields...I want the second date field to automatically add a
date 2 weeks to the date that is in the first date field?

So... the user would only have to type in one date field and the second
would automatically show the future (2 weeks) date?

Any ideas?

Thanks.

Yes I have an idea.
Don't!
Once you have the initial date entered, any time you need a different
date derived from that first entry, calculate it.
In a query:
NewDate:DateAdd("ww",2,[FirstDate])

Or directly in the control source of an unbound control on a form or
in a report:
=DateAddI("ww",2,[FirstDate])

In any event, saving this calculated value goes against the rules of
database normalization. There is no need to save this value.

Note: 2 weeks is the same as 14 days. You could also use
=[FirstDate] + 14
or
=DateAdd("d",14,[FirstDate])
 
R

RYANneedsHELP

even if i have to show two different dates: ex: date entered and due date?

fredg said:
I have two date fields...I want the second date field to automatically add a
date 2 weeks to the date that is in the first date field?

So... the user would only have to type in one date field and the second
would automatically show the future (2 weeks) date?

Any ideas?

Thanks.

Yes I have an idea.
Don't!
Once you have the initial date entered, any time you need a different
date derived from that first entry, calculate it.
In a query:
NewDate:DateAdd("ww",2,[FirstDate])

Or directly in the control source of an unbound control on a form or
in a report:
=DateAddI("ww",2,[FirstDate])

In any event, saving this calculated value goes against the rules of
database normalization. There is no need to save this value.

Note: 2 weeks is the same as 14 days. You could also use
=[FirstDate] + 14
or
=DateAdd("d",14,[FirstDate])
 
K

Klatuu

That is correct. One of the basic rules of database normalization is to
never store a value that can be derived from other available data, so if the
due date is always two weeks after the date entered, then the due date can
always be calculated on your form, on reports, or at any time you need to
export the date externally.

Just create a text box on your form and use its Control Source property to
display the calculated value. Assume the name of the control where you enter
the date entered is named txtDateEntered. The Code would be
=DateAdd("ww", 2, txtDateEntered)
--
Dave Hargis, Microsoft Access MVP


RYANneedsHELP said:
even if i have to show two different dates: ex: date entered and due date?

fredg said:
I have two date fields...I want the second date field to automatically add a
date 2 weeks to the date that is in the first date field?

So... the user would only have to type in one date field and the second
would automatically show the future (2 weeks) date?

Any ideas?

Thanks.

Yes I have an idea.
Don't!
Once you have the initial date entered, any time you need a different
date derived from that first entry, calculate it.
In a query:
NewDate:DateAdd("ww",2,[FirstDate])

Or directly in the control source of an unbound control on a form or
in a report:
=DateAddI("ww",2,[FirstDate])

In any event, saving this calculated value goes against the rules of
database normalization. There is no need to save this value.

Note: 2 weeks is the same as 14 days. You could also use
=[FirstDate] + 14
or
=DateAdd("d",14,[FirstDate])
 
R

RYANneedsHELP

RYANneedsHELP said:
even if i have to show two different dates: ex: date entered and due date? what does [firstdate] represent? The date will be different for each entry?

fredg said:
I have two date fields...I want the second date field to automatically add a
date 2 weeks to the date that is in the first date field?

So... the user would only have to type in one date field and the second
would automatically show the future (2 weeks) date?

Any ideas?

Thanks.

Yes I have an idea.
Don't!
Once you have the initial date entered, any time you need a different
date derived from that first entry, calculate it.
In a query:
NewDate:DateAdd("ww",2,[FirstDate])

Or directly in the control source of an unbound control on a form or
in a report:
=DateAddI("ww",2,[FirstDate])

In any event, saving this calculated value goes against the rules of
database normalization. There is no need to save this value.

Note: 2 weeks is the same as 14 days. You could also use
=[FirstDate] + 14
or
=DateAdd("d",14,[FirstDate])
 

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