ivonsurf123
Registered User.
- Local time
- Yesterday, 17:25
- Joined
- Dec 8, 2017
- Messages
- 69
Hello,
Could you help me to figure out how can I filter by month not only for the current year but for past years as well? I have tried but without a solution. Thank you.
Could you help me to figure out how can I filter by month not only for the current year but for past years as well? I have tried but without a solution. Thank you.
Code:
Private Sub cboMonth_AfterUpdate()
Dim dates(1) As Date
If Me.cboMonth = 0 Then
Me.subfrm_Invoice_Tracking.Form.Filter = ""
Me.subfrm_Invoice_Tracking.Form.FilterOn = False
Else
dates(0) = DateSerial(Year(Date), Me.cboMonth, 1)
dates(1) = DateSerial(Year(Date), Me.cboMonth + 1, 1) - 1
Me.subfrm_Invoice_Tracking.Form.Filter = _
"InvoiceDate >= #" & dates(0) & "# " & _
"AND InvoiceDate <= #" & dates(1) & "#"
Me.subfrm_Invoice_Tracking.Form.FilterOn = True
End If
End Sub