我有一个表,里面有日期列,记录事件日期,已知按月查询,代码如下:
'查看量房开始
Dim cbx1 As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim cbx2 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim filter As String = "1=1"
If cbx1.text > "" Then
Dim year As String = cbx1.text.SubString(0,2)
Dim month As String = cbx1.text.SubString(3,2)
Dim d As Date = new Date(year+2000, month, 1)
filter &= " and 量房时间 >= #" & d & "# and 量房时间 < #" & d.AddMonths(1) & "#"
End If
If cbx2.text > "" Then
filter &= " and 设计师 = '" & cbx2.text & "'"
End If
'msgbox(filter)
e.Form.controls("table1").Table.Filter = filter
'查看量房结束
但是按年查询,我的代码应该怎么改呢?求助大侠指点!如图,如案例!
此主题相关图片如下:qq截图20170219211521.jpg