--
你代码中错误有三:
1.日期表达式有空格(# "
& Date.Today & "
#" );
2.判断当月日期有误,不一定有31天(申请日期 <= #" & s & " /31/" & a3 & "#")
3.lbl(0).Text = " 当前筛选数 : " & (DataTables("售后出差申请")DataRows.Count) \'应为Tables("售后出差申请").Rows.Count
Dim Y1,M2,d3 As Integer
Dim D1,D2 As Date
Dim lbl(5) As WinForm.Label
Dim drs1 As List(Of DataRow)
Dim dt1 as DataTable = DataTables("售后出差申请")
lbl(1) = e.Form.Controls("总次数")
lbl(1).Text = " 出差总次数 : " & (dt1.dataRows.Count)
Y1 = Date.Today.Year
D1 = New Date(Y1,1,1)
D2 = New Date(Y1,12,31)
drs1 = dt1.Select("申请日期>= #" & D1 & "# and 申请日期 <= #" & D2 & "#")
lbl(2) = e.Form.Controls("本年度总次数")
lbl(2).Text = " 本年度出差次数 : " & (drs1.Count)
M2 = Date.Today.Month
d3 = Date.DaysInMonth(Y1,M2)
D1 = New Date(Y1,M2,1)
D2 = New Date(Y1,M2,d3)
drs1 = dt1.Select("申请日期>= #" & D1 & "# and 申请日期 <= #" & D2 & "#")
lbl(3) = e.Form.Controls("本月度总次数")
lbl(3).Text = " 本月出差次数 : " & (drs1.Count)
drs1 = dt1.Select("申请日期 = #" & Date.Today & "#" )
lbl(4) = e.Form.Controls("当天总次数")
lbl(4).Text = " 当天出差次数 : " & (drs1.Count)
lbl(0) = e.Form.Controls("当前总次数")
lbl(0).Text = " 当前筛选数 : " & (Tables("售后出差申请").Rows.Count)
[此贴子已经被作者于2013-4-5 10:54:20编辑过]