请教:我想明细账新增的第一行取自会计科目表的余额数字,,剩余的行取自凭证明细里面所有的行,我写了一段代码,第一行老是把2个表的数字融合在一起了,代码如下:
For Each dr As DataRow In DataTables("明细账").DataRows
dr.Delete()
Next
Dim txt As WinForm.TextBox = e.Form.Controls("tb科目代码")
Dim dr2 As DataRow = DataTables("会计科目").find("科目代码 = '"& txt.text & "'")
For Each dr As DataRow In DataTables("凭证明细").Select("科目代码 = '"& txt.Text & "'")
Dim dr1 As DataRow = DataTables("明细账").AddNew()
Dim dr3 As DataRow = DataTables("明细账").DataRows(0)
dr3("日期") = #01/01/2008#
dr3("余额") = dr2("期初余额")
dr3("方向") = dr2("方向")
dr3("摘要") = "期初余额"
dr1("日期") = dr("日期")
dr1("凭证ID") = dr("凭证ID")
dr1("摘要") = dr("摘要")
dr1("借方") = dr("借方金额")
dr1("贷方") = dr("贷方金额")
Next
此主题相关图片如下:明细账.png