I am relatively new to access and am trying to make the value date of form box(A) = form box (B) plus 2 years. If anyone could tell me how to do this it would be much appreciated!!!
I am relatively new to access and am trying to make the value date of form box(A) = form box (B) plus 2 years. If anyone could tell me how to do this it would be much appreciated!!!
In your text box B, use the DateAdd function. Here is an explanation
http://www.techonthenet.com/access/f...te/dateadd.php
Alan
THANKS I'm still not sure how to code dateadd ("yyyy",2, then text boxA for date
it will only except a preselected date which doesnt help me
Put this code in an afterupdate event for textbox A.
AlanCode:Private Sub TextboxA_AfterUpdate() Me.textboxB.Value = DateAdd("yyyy", 2, [textboxA]) Me.Requery End Sub
Thanks Alan. the textboxa is labeled Last PWRC and textboxb is labeled Next PWRC.
do I just replace textboxA with exactly Last PWRC in the code?
Yes, but as a general rule of thumb, you should not have spaces in your field names. But since you do, make sure that your surround your field name with brackets in the code. In the code title. Make sure the field name is joined with an underscore. ie. Last_PWRC. Really is best to not have spaces.
Hmmm
this is what I have:
Private Sub LastPWRC_AfterUpdate()
Me.NextPWRC.Value = DateAdd("yyyy", 2, LastPWRC)
Me.Requery
End Sub
After i ebter the date and press tab. nothing shows up in NextPWRC