1、先取了值,再去判断,逻辑混乱2、出错的是TextBox2控件,却去判断其它控件,有点饥不择食
……
Dim ld As Date = New Date(y,m,Days) '获得该月的最后一天
Dim Max0 As String
Dim idx As Integer
dim s as string = e.Form.Controls("TextBox2").text
if s.length >2 then s = s.SubString(0,2)
Dim flt As String = "[字号] = '" & s & "' And [日期] >= #" & fd & "# And [日期] <= #" & ld & "#"
Dim dts As Integer = DataTables("财务数据源").Compute("Count([会计科目])","[字号] = '" & e.Form.Controls("TextBox2").text & "' And [日期] >= #" & fd & "# And [日期] <= #" & ld & "# And [凭证号] = '" & di & "'")
……