I am trying to Filter by year and/or month in a date column of a dataview. For example: I would like to see(in my databound datagrid) all of the sales made in 2003(or whatever year is selected from a combo box).
In Visual Basic I was able to perform this by using the following: (Where "dDateOfOrder" is the name of the column in the database)
If cmbYear.ListIndex = 0 Then
sYearFilter = ""
Else
sYearFilter = "(Year([dDateOfOrder]) = " & cmbYear.Text & ")"
End If
datRecords.RecordSource = BuildRecordSource()
datRecords.Refresh
The variable "sYearFilter" is then passed to a function that builds the complete SQL statement which returns the appropriate recordset, to which "datRecords" is bound.
Is there any way to perform this same thing within a dataview?
Thanks
In Visual Basic I was able to perform this by using the following: (Where "dDateOfOrder" is the name of the column in the database)
If cmbYear.ListIndex = 0 Then
sYearFilter = ""
Else
sYearFilter = "(Year([dDateOfOrder]) = " & cmbYear.Text & ")"
End If
datRecords.RecordSource = BuildRecordSource()
datRecords.Refresh
The variable "sYearFilter" is then passed to a function that builds the complete SQL statement which returns the appropriate recordset, to which "datRecords" is bound.
Is there any way to perform this same thing within a dataview?
Thanks