多了个空格吧?
dr("本期生产成本_材料费用") = DataTables("凭证明细").Compute("Sum(借方金额)","年='" & ny.Value & "' And 年_月='" & my.Value & "' And 科目代码 Like '40010002%' And 纳税识别号 = '" & sbh & "'")