明细表的查询按钮代码:改成下面的代码
DataTables("明细账").DeleteFor("")
dim f As New Filler
if vars("起始日期") is nothing or vars("截止日期") is nothing or vars("工程编号") is nothing then
messagebox.show("起始日期或截止日期为空或工程编号为空")
else
for each dr as datarow in datatables("单据明细").datarows
for each dc as datacol in datatables("明细账").datacols
if dr("科目名称")=dc.name and dr("日期")>=vars("起始日期") and dr("日期")<=vars("截止日期") and dr("工程编号")=vars("工程编号") then
dim drr as row=tables("明细账").addnew()
drr(dc.name)=dr("金额")
drr("日期")=dr("日期")
drr("摘要")=dr("摘要")
drr("单据编号")=dr("单据编号")
drr("科目类别")=dr("科目类别")
drr("可用款余额")=DataTables("明细账").Compute("Sum(工程款)")-DataTables("明细账").Compute("Sum(工资)")-DataTables("明细账").Compute("Sum(税金)")
end if
next
next
end if