日记账-父表
明细账-子表
通过“流水编号”关联
想要实现的功能:
当明细帐中的余额等于日记账中的余额时
日记账中的“流水状态”更改为相应的提示信息
计算什么的都没有问题,就是不能改变日记账中的“流水状态”
麻烦给看一下,谢谢
DataColChanged中的代码
Dim lsbh As String = e.DataRow("流水编号")
Select Case e.DataCol.Name
Case "收入","支出"
Dim sr As Double
Dim zc As Double
Dim ye As Double
sr = e.DataTable.Compute("sum(收入)","[流水编号] = '" & lsbh & "'")
zc = e.DataTable.Compute("sum(支出)","[流水编号] = '" & lsbh &"'")
ye = sr - zc
MessageBox.Show("余额是:" & ye)
Dim rjz As DataRow = DataTables("日记账").SQLFind("[流水编号] = '" & lsbh & "'")
MessageBox.Show("日记账的流水编号是:" & rjz("流水编号"))
If ye > 0 Then
Dim rjzsr As Double = rjz("收入")
MessageBox.Show("日记账收入是:" & rjzsr)
If ye = rjzsr Then
Dim srywc As String = "收入已完成"
rjz("流水状态") = srywc
Else
Dim srwwc As String = "收入未完成"
rjz("流水状态") = srwwc
End If
ElseIf ye < 0 Then
Dim rjzzc As Double = rjz("支出")
MessageBox.Show("日记账支出是:" & rjzzc)
If ye * -1 = rjzzc Then
Dim zcywc As String = "支出已完成"
rjz("流水状态") = zcywc
Else
Dim zcwwc As String = "支出未完成"
rjz("流水状态") = zcwwc
End If
End If
End Select
麻烦给看一下,是不是这个样子不能用?