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

DateAdd function - add in value and replicate

Status
Not open for further replies.

debbie1212

Programmer
May 31, 2000
66
US
I have a date field that, when filled in, it checks the value in a list box (30, 60 or 90 days), and it calculates the new date and puts it into another field.

And to make things complicated, that new date field also has to check the next list box (30, 60 or 90), and it calculates another new date and puts it into another field. This is all done at once. In other words, the first date field is entered and it goes through and calculates all of the other date fields according to the value in the next record.

For instance:

Date field #1 + Value of list box #1 = Date field #2
Date field #2 + Value of list box #2 = Date field #3
Date field #3 + Value of list box #3 = Date field #4
Date field #4 + Value of list box #4 = Date field #5
and so on.

I know about the DateAdd Function but I'm lost on how to write it so that it takes in a value that is from a list box and then processes all of the calculations as soon as the first field is entered.

Can anyone help? I hope this makes sense.

Thanks.

 
I forgot to mention that when the first field is completed, it refreshes the screen with all of the new dates.

Thanks.
 
do you want something like this??
Date = date
if (list box == 30)
NewDate = DateAdd("d", 30, date)
'returns current date plus 30 days, so if its june 17 02
'it returns july 17 02 I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Is that how I have to do it for each one? There are actually more choices than I listed. They can choose 30, 60, 90, 120, 150 or 180.

Also, after I get the first date calculated, how do I get it to check the value in the next list box and place this new date in the next date box, and so on? This is a schedule that breaks down each step of a project and there are actually 8 new date fields that need to be calculated. This needs to be done all at once and then refresh the screen with the dates.

Thanks.
 
Hey Debbie,

Try something like this:

Date2 = DateAdd ("d", int(request.form("Date1DropDownValue")),request.form("date1"))

Date3 = DateAdd ("d", int(request.form("Date2DropDownValue")),Date2)

Hope this helps.. Cheers!
 
Hey Debbie,

Try something like this:

Date2 = DateAdd ("d", int(request.form("Date1DropDownValue")),request.form("date1"))

Date3 = DateAdd ("d", int(request.form("Date2DropDownValue")),Date2)

Hope this helps.. Cheers!
 
It looks like this is what I need. I will give it a try in a little bit and see if it works.

Thank you so much for taking the time to help me.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top