Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using DateAdd to Calculate 12mos in Advance 1

Status
Not open for further replies.

nubianqueen

Technical User
Apr 16, 2002
19
US
I have two fields,[ReviewedDate]and [TargetDate]in my table and on a form. The task is when a user enters ReviewedDate (format = mmm-yyyy)I need the TargetDate field to automatically populate a date of 12 months in advance).
I'm pretty sure I should use the DateAdd function, but does it go like this?

DateAdd("mmm",12,[ReviewedDate]
Also where can I attach the formula for it to update the table and the form.
I'd appreciate any help.
Thanks


 

I have somthing like this in a db that does the same as you are asking, this code i have placed in the after update

If IsNull([RewiewedDate]) Then

Else
[TargetDate] = DateAdd("m","12", [ReviewedDate])
End If
End Sub

I hope this makes sense and helps you out
 
Just another idea you coulod just add the the one line to the control source of the field you want the calulation in

= DateAdd("m","12", [ReviewedDate])

I still think
 
Yes that will work for you the only part you seem to need is this part:

[TargetDate] = DateAdd("m","12", [ReviewedDate])

But if you are going to have any null values in [ReviewedDate] you gotta make sure ya write in some code to set the reviewed date at least to the current date or ya gonna get and error. Good luck to ya!!!!


If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmm
 
Thanks for the help,I had problems with the DateAdd attached to after update, but it worked in the control source property.
 
I thought I was done with this issue, but after looking at my table, the TargetDate field is not populating into the table, it's only in the from. What am I missing here,
 
Is the target date box a unbound field ? if it is iam having this problem too, iam trying to sort this and have posted over this but if you find out could you let me know and i will do the same.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top