Hi there,
I am having really problems with one piece of code... The other two filters are working fine, but the date filter is not working.
In the main table, the ActionDate field is defined as Date/Time (Short Date) as well as in the form. Still I am not able to make it run....
I get the following error message at this line:
Code:
Me.subfrmReport.Form.RecordSource = task
This is what the form looks like:
I used the idea and code from austin72406 https://www.youtube.com/watch?v=choPri7y_o4
Code:
Function SearchCriteria()
Dim StatusName, TypeID, ActionDate As String
Dim task, strCriteria As String
If IsNull(Me.cboStatus) Then
StatusName = "[StatusName] like '*'"
Else
StatusName = "[StatusName] = '" & Me.cboStatus & "'"
End If
If IsNull(Me.cboType) Then
TypeID = "[TypeID] like '*'"
Else
TypeID = "[TypeID] = " & Me.cboType
End If
If IsNull(Me.cboActionDate) Then
ActionDate = "[ActionDate] like '*'"
Else
ActionDate = "[ActionDate] = #" & Me.cboActionDate & "#"
End If
strCriteria = StatusName & " AND " & TypeID & " AND " & ActionDate
task = "SELECT * FROM tblReport WHERE " & strCriteria
Me.subfrmReport.Form.RecordSource = task
Me.subfrmReport.Form.Requery
End Function
Can someone see what I am doing wrong.... I don't know what to do.
Regards