以下是引用lfz123在2019/1/10 10:17:00的发言:我的理解应该是错的,结果还是不对,在麻烦您帮我看下,谢谢!
tb(0,3) = dt.Compute("sum(贷方金额)","一级码 = '5101'and 年份 = '"& d.Year & "'and 月份 = '"& d.Month & "'and 月份 < '"& d.Month & "' ") '营业收入
1、月份列改成整数列,不要用字符列;
2、执行测试代码
Dim d As Date = "2018年2月"
Dim by = DataTables("凭证明细").Compute("sum(贷方金额)","一级码 = '5101'and 年份 = '"& d.Year & "'and 月份 = '"& d.Month & "'") '营业收入
msgbox(by)
Dim lj = DataTables("凭证明细").Compute("sum(贷方金额)","一级码 = '5101'and 年份 = '"& d.Year & "'and 月份 <= '"& d.Month & "'") '营业收入
msgbox(lj)