Foxtable(狐表)用户栏目专家坐堂 → 求助防重复录入的问题


  共有2661人关注过本帖平板打印复制链接

主题:求助防重复录入的问题

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


加好友 发短信
等级:超级版主 帖子:107135 积分:544918 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/4/2 17:31:00 [只看该作者]

Select Case e.DataCol.name   '日期姓名防重复输入验证
    Case "日期","姓名"
        Dim xh As date
        Dim gg As String
        If e.DataCol.Name= "月份" Then
            xh = new date(e.NewValue.year,e.NewValue.month,1)
            gg = e.DataRow("姓名")
        Else
            gg = e.NewValue
            xh = new date(e.DataRow("日期").year,e.DataRow("日期").month,1)
        End If
        If xh > "" AndAlso gg  > "" Then 
            Dim dr As DataRow = e.DataRow
            If e.DataTable.Find("日期 >= #" & xh & "# and 日期 < #" & xh.addmonths(1) & "# And 姓名 = '" & gg & "'") IsNot Nothing Then
                MessageBox.Show("该学员本月已录入完成,不能重复,只能修改!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
                e.Cancel = True
            End If
        End If
End Select

 回到顶部