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

Field Calculations

Status
Not open for further replies.

pd06498

IS-IT--Management
Dec 10, 2003
36
0
0
AU
I want to populate a field from a date, to show a future year in anoter field on a form. I then want to be able to use this field as the basis for searches.

I am using the formula =DatePart("yyyy",[DateTo]) + ([Years]+1)

DateTo is the date I enter and I want to change this to the year (i.e. 1/10/1995 becomes 1995, but still displays the full date in the DateTo field), and add the number of years listed in [Years](from another table) + 1.
Any ideas how I can do this in code. I got it to work once using macros and extra text boxes but it looks tacky and cumbersome.

I've been playing with this for several days without any joy.

Thanks in advance.
 
What about using a query to display the next Year.

In the crieria of [Years] field the query you would do something like this.

DatePart("yyyy",[DateTo])+1

Alternaltively you could simply use this formula =DatePart("yyyy",[DateTo])+1 in another textbox (called [txtYear]) on the form, once you have entered the date in the DateTo textbox and you tab out of that textbox the other textbox [txtYear] will be populated with the next year.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top