请教老师:我在表datacolchanged 中If e.DataCol.Name = "余额" Then
Dim dma,dmb As String
Dim sda As Integer
Dim jea As Double
Dim dra As DataRow
For Each dr As Row In Tables("科目初始数据表").Rows
If dr("编辑") = False Then
dma = dr("科目代码")
sda = dma.Length
dmb = dma.SubString(0,sda-3)
Do While sda>4
'计算上一级科目的合计数
jea = Tables("科目初始数据表").Compute("sum(余额)","len(科目代码)=" & sda And "substring(科目代码,1,sda-3) = '" & dmb & "'")
'找上一级代码
dra = DataTables("科目初始数据表").Find("科目代码 = '" & dmb & "'")
If dra IsNot Nothing Then
dra("余额") = jea
End If
sda = sda -3
dmb = dmb.SubString(0,sda-3)
Loop
End If
Next
End If
运行中:jea = Tables("科目初始数据表").Compute("sum(余额)","len(科目代码)=" & sda And "substring(科目代码,1,sda-3) = '" & dmb & "'")这行代码
出现:详细错误信息:
调用的目标发生了异常。
从字符串“len(科目代码)=7”到类型“Long”的转换无效。
输入字符串的格式不正确。
请教代码如何修改?