Rockape
10-02-2008, 08:36 AM
Hi all,
I'm trying to pick up records between two ranges. Previously I have managed to select pick out the previous months entries using the following modules.
Function FirstDayOfLastMonth2() As Date
FirstDayOfLastMonth2 = DateSerial(Year(Date), Month(Date) - 1, 1)
End Function
Function LastDayOfLastMonth2() As Date
LastDayOfLastMonth2 = DateSerial(Year(Date), Month(Date), 0)
End Function
I then used a query to select the records between these two ranges.
My question is slightly different now. I'm trying to select the following range;
the entries between today's date and the last seven days of the previous month. I have tried playing around with =today()
Function lastweekofpreviousmonth() As Date
lastweekofpreviousmonth =
DateSerial(Year(Date), Month(Date) - 1, 0-7)
End Function
Function today() As Date
today = now()
End Function
Does not work (tried different permutations)
Grateful for comments/advice
Regards
I'm trying to pick up records between two ranges. Previously I have managed to select pick out the previous months entries using the following modules.
Function FirstDayOfLastMonth2() As Date
FirstDayOfLastMonth2 = DateSerial(Year(Date), Month(Date) - 1, 1)
End Function
Function LastDayOfLastMonth2() As Date
LastDayOfLastMonth2 = DateSerial(Year(Date), Month(Date), 0)
End Function
I then used a query to select the records between these two ranges.
My question is slightly different now. I'm trying to select the following range;
the entries between today's date and the last seven days of the previous month. I have tried playing around with =today()
Function lastweekofpreviousmonth() As Date
lastweekofpreviousmonth =
DateSerial(Year(Date), Month(Date) - 1, 0-7)
End Function
Function today() As Date
today = now()
End Function
Does not work (tried different permutations)
Grateful for comments/advice
Regards