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

Loop between two dates

Status
Not open for further replies.

bgv

Programmer
Sep 23, 2003
29
US
I have a form that has a starting date (txtStartDate) and a stop date (txtStopDate). How do I set up a for next loop to enter each date as a value into a table?
 
Code:
Function dateasinteger()
    Dim startdate As Date
    Dim stopdate As Date
    Dim i As Double
    
    startdate = #6/13/2003#
    stopdate = #7/13/2003#
    
    For i = CDbl(startdate) To CDbl(stopdate)
        'code in here to insert to table
        Cdate(i) ' changes the double back to a date
    Next
    
End Function

You would obviously have a different way to get the dates but this should work. The dates above have a difference as doubles of 30 so each step is an incremental date between the two.

Redapples

Want the best answers? See FAQ181-2886

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top