Foxtable(狐表)用户栏目专家坐堂 → 修改代码


  共有1760人关注过本帖树形打印复制链接

主题:修改代码

帅哥哟,离线,有人找我吗?
发财
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1470 积分:8981 威望:0 精华:0 注册:2013/10/24 9:12:00
修改代码  发帖心情 Post By:2016/3/2 9:18:00 [只看该作者]

Dim n As Integer = DataTables("凭证").Compute("Max(凭证ID)") 
Dim r As Row = Tables("凭证").Current(n)
If r IsNot Nothing Then
    If r.IsNull("附件张数") Then
        MessageBox.Show("附件张数不允许为空!")
        e.Cancel = True
    End If
    If r("借方金额") <> r("贷方金额") Then
        MessageBox.Show("借贷不平衡!")
        e.Cancel = True
    End If
    If Tables("凭证.凭证明细").Rows(0)("借方金额") = "" Then
        MessageBox.Show("请录入借贷金额!")
        e.Cancel = True
    End If
End If
代码第一、二句应如何改?

 回到顶部
帅哥哟,离线,有人找我吗?
发财
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1470 积分:8981 威望:0 精华:0 注册:2013/10/24 9:12:00
  发帖心情 Post By:2016/3/2 9:30:00 [只看该作者]

Dim cr As Row = Tables("凭证").current
If cr("凭证ID") < DataTables("凭证").Compute("Max(凭证ID)") Then
    With Tables("凭证")
        .Position = .Rows.Count - 1
    End With
End If
Dim r As Row = Tables("凭证").Current()
If r IsNot Nothing Then
    If r.IsNull("附件张数") Then
        MessageBox.Show("附件张数不允许为空!")
        e.Cancel = True
    End If
    If r("借方金额") <> r("贷方金额") Then
        MessageBox.Show("借贷不平衡!")
        e.Cancel = True
    End If
    If Tables("凭证.凭证明细").Rows(0)("借方金额") = "" Then
        MessageBox.Show("请录入借贷金额!")
        e.Cancel = True
    End If
End If
这样改,感觉太多余了吧?


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/2 10:18:00 [只看该作者]

这个意思?

 

 
Dim r As Row = Tables("凭证").Rows(Tables("凭证").Rows.Count - 1)

 回到顶部