D
david
Hi,
I have a form with 2 select objects which are not linked together in
any way. The list exactly the same information.
The code that generates the data is:
_________________________________________
<SCRIPT language='vbscript'>
Sub Window_Onload
Dim TheDate
Dim Count
Dim Options
Dim Options2
TheDate2 = Date + vbThursday - WeekDay(Date)
TheDate = Date + vbTuesday - WeekDay(Date)
If TheDate < Date Then TheDate = TheDate +7
Set Options = Document.all.date.Options
Set Options2 = Document.all.todate.Options
For Count = 1 To 20-1
StrDate = "Tuesday " & Right("0" & Day(TheDate),2) & "/" &
Right("0" & Month(TheDate),2) & "/" & Year(TheDate)
Options.Add Window.Option(StrDate,"from " & StrDate)
Options2.Add Window.Option(StrDate,"to " & StrDate)
TheDate = TheDate + 7
StrDate2 = "Thursday " & Right("0" & Day(TheDate2),2) & "/" &
Right("0" & Month(TheDate2),2) & "/" & Year(TheDate2)
Options.Add Window.Option(StrDate2,"from " & StrDate2)
Options2.Add Window.Option(StrDate2,"to " & StrDate2)
TheDate2 = TheDate2 + 7
Next
End Sub
</script>
______________________________________________
The information is correct, except that every now and again the Tusdays
& Thursdays are wrong way around depending on the current date, i.e.
it should display:
Thursday 03/02/2005
Tuesday 08/02/2005
looping continuously with Tuesdays & Thursdays in the correct date
order.
I seem to get
Tuesday 08/02/2005
Thursday 03/02/2005
How can I correct this code so that no matter what the actual date is,
the data is always in the correct order ?
Appreciate your advice
David.
I have a form with 2 select objects which are not linked together in
any way. The list exactly the same information.
The code that generates the data is:
_________________________________________
<SCRIPT language='vbscript'>
Sub Window_Onload
Dim TheDate
Dim Count
Dim Options
Dim Options2
TheDate2 = Date + vbThursday - WeekDay(Date)
TheDate = Date + vbTuesday - WeekDay(Date)
If TheDate < Date Then TheDate = TheDate +7
Set Options = Document.all.date.Options
Set Options2 = Document.all.todate.Options
For Count = 1 To 20-1
StrDate = "Tuesday " & Right("0" & Day(TheDate),2) & "/" &
Right("0" & Month(TheDate),2) & "/" & Year(TheDate)
Options.Add Window.Option(StrDate,"from " & StrDate)
Options2.Add Window.Option(StrDate,"to " & StrDate)
TheDate = TheDate + 7
StrDate2 = "Thursday " & Right("0" & Day(TheDate2),2) & "/" &
Right("0" & Month(TheDate2),2) & "/" & Year(TheDate2)
Options.Add Window.Option(StrDate2,"from " & StrDate2)
Options2.Add Window.Option(StrDate2,"to " & StrDate2)
TheDate2 = TheDate2 + 7
Next
End Sub
</script>
______________________________________________
The information is correct, except that every now and again the Tusdays
& Thursdays are wrong way around depending on the current date, i.e.
it should display:
Thursday 03/02/2005
Tuesday 08/02/2005
looping continuously with Tuesdays & Thursdays in the correct date
order.
I seem to get
Tuesday 08/02/2005
Thursday 03/02/2005
How can I correct this code so that no matter what the actual date is,
the data is always in the correct order ?
Appreciate your advice
David.