Dim b1 As WinForm.Label = e.Form.Controls("Label40")
Dim b2 As WinForm.Label = e.Form.Controls("Label41")
Dim b3 As WinForm.Label = e.Form.Controls("Label17")
Dim b4 As WinForm.Label = e.Form.Controls("Label50")
Dim b5 As WinForm.Label = e.Form.Controls("Label46")
b1.Text = Tables("现场检查").Compute("count(审核状态)", "审核状态 = false and 录入时间 > #" & Today.AddDays(-1) & "#")
b2.Text = Tables("现场检查").Compute("count(审核状态)", "审核状态 = false and 录入时间 < #" & Date.Today() & "#")
b3.Text = Tables("现场检查").Compute("count(审核状态)", "审核时间 > #" & Today.AddDays(-1) & "#")
Dim n As Integer = Date.Today.DayOfWeek
Dim d1 As Date = iif(n=0,Date.today.Adddays(n-6),Date.today.Adddays(1-n))
Dim d2 As Date = iif(n=0,Date.today.Adddays(n),Date.today.Adddays(7-n))
Dim d3 As Date = New Date(Date.today.Year,Date.today.month,1)
Dim d4 As Date = New Date(Date.today.Year,Date.today.month,Date.DaysInMonth(Date.today.Year,Date.today.Month))
b4.Text = Tables("现场检查").Compute("count(审核状态)","审核时间 >= #" & d1 & "# And 审核时间 <= #" & d2 & "#")
b5.text = Tables("现场检查").Compute("count(审核状态)","审核时间 >= #" & d3 & "# And 审核时间 <= #" & d4 & "#")
表中的审核时间 和 录入时间 是yyyy-MM-DD HH:MM:SS 形式
d1,d2,d3,d4 是yyyy-MM-DD形式
原理上 只需要在代码里把 审核时间 录入时间 转化成 yyyy-mm-dd即可 和d1,d2,d3,d4 做比较了 但是实际操作了一下 转化d1-d4可以 但是不会把审核时间 录入时间 转化成yyyy-mm-dd
[此贴子已经被作者于2012-1-15 14:25:08编辑过]