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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Date In other Box

Status
Not open for further replies.

bradzy88

Programmer
Feb 14, 2004
7
US
How do I make a date auto appear in another box.

For example:
Birthday Date Admited
6-8-88 (HOW DO I MAKE THIS Date THREE YEARS
FROM HIS BIRTHDAY AUTOMATICALY)

THANKS YOU ALL!!!
 
bradzy88
Take a look at the DateAdd function. Using it, there are 2 ways of doing it, depending on your form structure and the result you want.

If the [DateAdmitted] control is bound, meaning that you are storing the [DateAdmitted] value in your table, then on the AfterUpdate event for [Birthday] put the following code...
Me.DateAdmitted = DateAdd("yyyy",3,[Me.Birthday])

If you are not storing the [DateAdmitted} value in the table, and the [DateAdmitted] control is unbound, you can set the control source of the [DateAdmitted] directly by putting this as its control source...
=DateAdd("yyyy",3,[Me.Birthday])

In either case, set the format property of the [DateAdmitted] to whatever you want to see. If you want to see a short date, select that from the drop down box. If you want a full date, type mmmm dd, yyyy in the format property.

Tom
 
Thanks Tom,

You were close and led me on the right track teh code i used was
Me.DateAdmitted.Value = DateAdd("yyyy", 3, [Birthday])
Me.DateAdmitted.Requery

THANKS AGAIN!!!!
BENNY
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top