[AccessD] Store all days between 2 dates / Type Mismatch

paul.hartland at fsmail.net paul.hartland at fsmail.net
Thu Jan 29 07:26:30 CST 2004


Sander,
 
Try this:
 
Dim x as Integer
Dim arrDays() as Variant
Dim StartDate as Date
Dim EndDate As Date
Dim IncDate As Date
 
x = 0
IncDate = StartDate
Do Until(IncDate>EndDate)
            arrDays(x) = IncDate
            x = x + 1
            IncDate = IncDate + 1
Loop
 
Paul








Message date : Jan 29 2004, 01:17 PM
>From : "Sad Der" 
To : "Acces User Group" 
Copy to : 
Subject : [AccessD] Store all days between 2 dates / Type Mismatch
Hi group,

does anybody know how I can fill an array with the
DATES between a startdate and an enddate? 

I'm using datediff to calculate the no of days. I want
to use this in a loop e.g.:
Dim x as Integer
Dim arrDays() as Variant
Dim intNumberOfDays as Integer
dim strStart as String
Dim strEnd as String
intNumberOfDays = DateDiff("d", strStart, strEnd)

ReDim arrDays(intNumberOfDays)
for x = 0 to intNumberOfDays
arrDays(x) = strStart + x
next x

I keep getting a Type Mismatch error. I also tried:
arrDays(x) = CVAR(strStart + x)

Any ideas?
TIA.

Sander

Example:
StartDate EndDate Return value(s)
21/01/2004 21/01/2004 21/01/2004
21/01/2004 22/01/2004 21/01/2004;22/01/2004
31/12/2003 02/01/2004 31/12/2003;01/01/2004;02/01/2004




__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
Freeserve AnyTime - HALF PRICE for the first 3 months - Save £7.50 a month 
www.freeserve.com/anytime


More information about the AccessD mailing list