这样试试?
If(Text([%开始日期%])="" And Text([%结束日期%])="",
SumFor([材料名称]+"_"+[规格型号]+"【"+[计量单位]+"】","借方_数量"),
SumFor([材料名称]+"_"+[规格型号]+"【"+[计量单位]+"】","借方_数量","日期",">=",[%开始日期%],"日期","<=",[%结束日期%]))
最好发文件看看