Create dynamic

raystownlaura

Registered User.
Local time
Today, 09:47
Joined
Apr 16, 2010
Messages
22
I need to write a procedure dynamically create a new recordset with one column called "Dates" to use temporarily. I want to fill these values with the dates between two user entered dates. For example,

Begin Date=7/1/2011
End Date=7/15/2011

Create new recordset now containing one column (field) called dates, and fill the values in the date column with all of the dates between Begin Date and End Date, including the actual begin and end dates.

Any help including code samples would be hugely appreciated!!! Thanks!
 
Would not an array of dates be better?
Do you need to set it as a form's recordset? (If not a date array would be easier and more efficient)
 
I thought about that but I totally suck at arrays. Can you help with some code perhaps?
 
OK, off the top of my head:

Code:
Dim dts() as Date
ReDim dts(0)
dts(0) = CDate("07/01/2011")
Do While Not (dts(UBound(dts)) >= CDate("07/15/2011"))
    ReDim Preserve dts(UBound(dts) + 1)
    dts(UBound(dts)) = DateAdd("d",1,dts(UBound(dts) - 1)) 
Loop
 

Users who are viewing this thread

Back
Top Bottom