Title:         
Name: DifferentDays
Web-Link: http://www.arabteam2000-forum.com/index.php?showtopic=140444
Description: Week days repeats between two dates
Department: Microsoft Access
Develop Using: Microsoft Access 2003
Assistant Tool(s): Microsoft Date and Time Picket ActiveX control
Version: 1.00
Last update: 07 February 2008
Date: 07 February 2008
Time Zone: (GMT + 02:00) Cairo
Revised by: Eng. Usama El-Mokadem: musama@hotmail.com

Topic(140444) [Sep 30 2007, 08:57 AM]: By  2000: http://www.arabteam2000-forum.com/index.php?showuser=76909
===========
-----BEGIN TOPIC-----
 

       

  : 1/1/2007   : 30/3 / 2007

       60   

   ....

   

           
-----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:
============
DifferentDays.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