Title:          ,          
Web-Link: http://www.arabteam2000-forum.com/index.php?showtopic=127920
Description: Week day repeats between two dates
Department: Visual Basic forum
Develop Using: Microsoft Visual Basic 6.0
Assistant Tool(s):
Version: 1.00
Last update: 23 May 2007
Date: 23 May 2007
Time Zone: (GMT + 02:00) Cairo
Revised by: Eng. Usama El-Mokadem: musama@hotmail.com

Topic(127920) [May 23 2007, 03:57 PM]: By  : http://www.arabteam2000-forum.com/index.php?showuser=106196
=======
-----BEGIN TOPIC-----
         

                
-----END TOPIC-----

Solution:
=======
-----BEGIN SOLUTION-----

Private Function GetRepeats(FromDate As Date, ToDate As Date, nDay As Integer) As Long
    Dim StartDate As Date
    Dim PreDays As Integer

    PreDays = nDay - Weekday(FromDate)
    If PreDays < 0 Then PreDays = PreDays + 7
    StartDate = DateAdd("d", PreDays, FromDate)
    If StartDate <= ToDate Then
        GetRepeats = Int(DateDiff("d", StartDate, ToDate) / 7) + 1
    End If
End Function

  
-----END SOLUTION-----

Attachments:
============
DatesDays.zip
The (Attached) Solution Suggested By Eng. Usama El-Mokadem: http://www.arabteam2000-forum.com/index.php?showuser=98027

CONTACT INFORMATION:
=======================
  Eng. Usama El-Mokadem
  Email: musama@hotmail.com
  Web: http://musama.tripod.com
  Mobile: 0020 10 1289308
  Egypt