Actually what am trying to do is calculate how many hours in the current
month an employee has worked in the current month, this is what I have on my
form for calculating the hours for the current week!
=DSum("[THours]","tblTrackHours","Trackdate >= #" &
Format(StartOfWeek(),"mm/dd/yyyy") & "# And Trackdate < #" &
Format(StartOfWeek()+7,"mm/dd/yyyy") & "# And EmplID = " &
Forms![tblEmployee]!EmplID)
Where StartOfWeek =
Public Function StartOfWeek() As Date
Dim dtmDate As Date
dtmDate = VBA.Date
Do Until Weekday(dtmDate, vbSunday) = 1
dtmDate = dtmDate - 1
Loop
StartOfWeek = dtmDate
End Function
So I was thinking that if I use the same knowledge I would be able to
calculate the current monthly hours too....
What would be your suggestion?
Douglas J Steele said:
Not sure I understand what you mean by "gets the dates of the current month"
If you want the first day of the current month, use DateSerial(Year(Date),
Month(Date), 1)
If you want the last day of the current month, use DateSerial(Year(Date),
Month(Date) + 1, 0)
Is that what you're after?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
How do I create a standard module that gets the dates of the current month
only e.g, here is one that someone very helpful in the discussion group
helped me on getting the dates of the current week........
Public Function StartOfWeek() As Date
Dim dtmDate As Date
dtmDate = VBA.Date
Do Until Weekday(dtmDate, vbSunday) = 1
dtmDate = dtmDate - 1
Loop
StartOfWeek = dtmDate
End Function