I have the following code which I am trying to pull out the quarter for the current date. I have a variable for the current date and it is storing the date correctly, the issue is when I got to the select case for the quarter today's date turns in 01/03/1900.
Any guide will be greatly appreciate because I am going clueless on this.
Any guide will be greatly appreciate because I am going clueless on this.
Code:
Public Sub FRFilter()
Dim TodayDate As Date
TodayDate = DateValue(Date)
STFilter = ""
If Me!cboassignedto <> "" Then
STFilter = " TaskAssignedTo = " & Me!cboassignedto & ""
Debug.Print STFilter
End If
If Me!cbostatus <> "" Then
If STFilter = "" Then
STFilter = " taskstatus = " & Me!cbostatus & ""
Else
STFilter = STFilter & " AND taskstatus = " & Me!cbostatus & ""
End If
End If
If Me!cbodatefilter <> "" Then
If STFilter = "" Then
Select Case Me!cbodatefilter
Case 1 ' This Month
STFilter = " month(taskduedate) = " & Month(TodayDate) & ""
Case 2 ' This Quarter
TodayDate = DatePart("q", Now)
Debug.Print TodayDate
STFilter = DatePart("q", (TaskDueDate)) = " & TodayDate & "
Debug.Print STFilter
Case 3 ' This Year
Case 4 ' Last Year
Case 5 ' Date Range
End Select
Else
'nothing yet
End If
End If