J
James Frater
Hello Everyone,
I've got a loop running, however it always seems to miss off the first date,
so any help would be greatly appreciated.
So, the fields/data I have are:
[startdate] = 18/01/2009
[enddate] = 08/03/2009
[totalweeks] = 7 (this is a datepart() calculation)
Once the code is run I should end up with
1 18/01/2009
2 25/01/2009
3 01/02/2009
4 08/02/2008
5 15/02/2009
6 22/02/2009
7 01/03/2009
8 08/03/2009
but what I'm getting is:
1 25/01/2009
2 01/02/2009
3 08/02/2008
4 15/02/2009
5 22/02/2009
6 01/03/2009
7 08/03/2009
I've tried using a "+1" in various places however it still won't add in the
first date.
intcounter = 0
intstartdate = Me![StartDate]
Do While intcounter <= Me![TotalWeeks]
intcounter = intcounter + 1
intstartdate = DateAdd("d", 7, intstartdate)
rstprogramme.AddNew
rstprogramme!Fixture= intcounter
rstprogramme!EventName = Me![EventName]
rstprogramme!EventStart= intstartdate
rstprogramme.Update
If intcounter = Me![TotalWeeks] Then
Exit Do
End If
Loop
I've got a loop running, however it always seems to miss off the first date,
so any help would be greatly appreciated.
So, the fields/data I have are:
[startdate] = 18/01/2009
[enddate] = 08/03/2009
[totalweeks] = 7 (this is a datepart() calculation)
Once the code is run I should end up with
1 18/01/2009
2 25/01/2009
3 01/02/2009
4 08/02/2008
5 15/02/2009
6 22/02/2009
7 01/03/2009
8 08/03/2009
but what I'm getting is:
1 25/01/2009
2 01/02/2009
3 08/02/2008
4 15/02/2009
5 22/02/2009
6 01/03/2009
7 08/03/2009
I've tried using a "+1" in various places however it still won't add in the
first date.
intcounter = 0
intstartdate = Me![StartDate]
Do While intcounter <= Me![TotalWeeks]
intcounter = intcounter + 1
intstartdate = DateAdd("d", 7, intstartdate)
rstprogramme.AddNew
rstprogramme!Fixture= intcounter
rstprogramme!EventName = Me![EventName]
rstprogramme!EventStart= intstartdate
rstprogramme.Update
If intcounter = Me![TotalWeeks] Then
Exit Do
End If
Loop