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!

caculate a date field and returnning new date to another field

Status
Not open for further replies.

Proteus7

IS-IT--Management
Feb 26, 2002
75
US
I know how to use the Date(), -13 to get a date that occured 13 days ago. What I can't figure out is how to do is this, Table A has a field "FirstDate" the client enters this date at some time. Then some time later another client will use this date. This is where I need the help this Firstdate needs to have 13 days removed from it and return the whole new date for the field SecondDate that is printed out. I know that it would have been easier to make this caculation when the first one is entered but it is not set up to do it at that time.
How do I do this? I know it is something simple.

thanks larry
 
I am not sure that I have understood your problem correctly. If you want to have seconddate replace with firstdate - 13 the statement :
'replace all secconddate with firstdate - 13' will do it.

(Assuming seccondate is a date field)

If you want to replace the secccondate at the time of entry of firstdate in the valid event - the statement
'replace secconddate with firstdate - 13' will achieve it.


 
OK,

The first date is save in a field. When that date is used again it needs to produce the second date which is to be 13 days earlier than the first date.

Ex: first date is 01/14/00
when it is used the second time then it needs to produce
second date which is 01/01/00 and this new date is used for confirmation for other things.

I can not use this on all first dates because not all first dates are used.

I hope that helps
 
What is the value of the datefield when it is not used. Is it empty or does it have some default date and how is the date field populated - is is entered through a form or changed programitically?

If it is entered through a form and assuming the date is blank if not used - you could put the following code in the valid event of the form.

if not empty(firstdate)
replace secondate with firstdate - 13
endif

HTH



 
Hi Proteus,

YOu can always do that by creating a memory variable and controling whenever required.

Example.. first time stored date.. let us say..

DateField = {01/01/00}

When you run the programe to do some activity and want the first date-13 as confirmation date.. always use..

(dateField-13) instead of secondDate or whatever.

:)

ramani :)
(Subramanian.G)
 
thanks for all your help.
I know that the answer was simple. I was trying

date(datefield-13) and it would not work

but the (datefield -13) was what I needed.

Thanks to all

Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top