Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2003, 09:31 AM
Authorized User
 
Join Date: Dec 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying a range of dates

 I am currently writing a database that controls holidays in access 2000 and am experiencing a problem.

I have a holiday input form which takes the input values from an active x calender and stores the dates in 2 variables. 1) StartDate and 2) EndDate.

My Problem is simply i need to display the range of dates between StartDate + EndDate and count the Occurrence that another field is displayed on these dates.

I can get them it to display the startday and occurrence , as well as the end day and occurrence but not the middle values.

I would be very grateful for any assistance


 
Old December 10th, 2003, 10:22 AM
Authorized User
 
Join Date: Oct 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This will output the date values to the debug window, but
you can send them to a form, report, or table as well:

Public Function DateLoop()
    Dim dtmStartDate As Date
    Dim dtmEndDate As Date
    Dim dtmCalcDate As Date

    dtmStartDate = "12/10/2003"
    dtmEndDate = "1/15/2004"

    dtmCalcDate = dtmStartDate

    Do
       dtmCalcDate = DateAdd("d", 1, dtmCalcDate)
       If dtmCalcDate = dtmEndDate Then
          Exit Do
       End If
       Debug.Print dtmCalcDate
    Loop

End Function

You can get more help on the DateAdd() function in online help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Range Validator dcct84 C# 2 October 12th, 2007 08:30 AM
Date Range Flipflop SQL Language 6 November 25th, 2005 08:36 AM
Help with Date Range PacMed Access 1 February 1st, 2005 12:30 PM
Date Range mrideout BOOK: Beginning ASP.NET 1.0 0 January 2nd, 2005 07:18 PM
Group By months for a range of dates singh_ginni SQL Language 2 September 8th, 2003 09:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.