Foxtable(狐表)用户栏目专家坐堂 → 到期提醒一个表只提醒一次


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

主题:到期提醒一个表只提醒一次

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


加好友 发短信
等级:小狐 帖子:364 积分:3491 威望:0 精华:0 注册:2012/7/24 7:15:00
到期提醒一个表只提醒一次  发帖心情 Post By:2018/10/22 17:33:00 [只看该作者]

一个表中有两个或三个到期,只提醒一次,如何解决,代码如何改?谢谢

Dim dt4 As Date = Date.Today.AddDays(30)
Dim dr20 As DataRow = DataTables("安全资格培训").Find("下次培训日期 <= #" & dt4 & "#")
Dim dtdq As Date = Date.Today
Dim dr21 As DataRow = DataTables("安全资格培训").Find("下次培训日期 < #" & dtdq & "#")
If dr21 IsNot Nothing Then
    MessageBox.Show(dr21("企业名称") & ":" & vbcrlf & "    企业负责人/安全员培训合格证已过期未复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
ElseIf dr20 IsNot Nothing Then
    MessageBox.Show(dr20("企业名称") & ":" & vbcrlf & "    企业负责人/安全员培训合格证即将到期复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/10/22 17:45:00 [只看该作者]

Dim dt4 As Date = Date.Today.AddDays(30)
Dim dr20 As String= DataTables("安全资格培训").GetComboListString("企业名称", "下次培训日期 <= #" & dt4 & "#")
Dim dtdq As Date = Date.Today
Dim dr21 As String= DataTables("安全资格培训").GetComboListString("企业名称", "下次培训日期 < #" & dtdq & "#")
If dr21 > "" Then
    MessageBox.Show(dr21 & ":" & vbcrlf & "    企业负责人/安全员培训合格证已过期未复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
End If
If dr20 > "" Then
    MessageBox.Show(dr20 & ":" & vbcrlf & "    企业负责人/安全员培训合格证即将到期复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

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


加好友 发短信
等级:小狐 帖子:364 积分:3491 威望:0 精华:0 注册:2012/7/24 7:15:00
  发帖心情 Post By:2018/10/23 7:13:00 [只看该作者]

1.使用你的代码:
f dr21 > "" Then
    MessageBox.Show(dr21 & ":" & vbcrlf & "    企业负责人/安全员培训合格证已过期未复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
End If
If dr20 > "" Then
    MessageBox.Show(dr20 & ":" & vbcrlf & "    企业负责人/安全员培训合格证即将到期复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
出现以下问题:一个表中有已过期的记录,那么本条记录既提示已过期,也提示即将过期。提示两次

2.使用如下代码:
f dr21 > "" Then
    MessageBox.Show(dr21 & ":" & vbcrlf & "    企业负责人/安全员培训合格证已过期未复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
elseIf dr20 > "" Then
    MessageBox.Show(dr20 & ":" & vbcrlf & "    企业负责人/安全员培训合格证即将到期复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
出现以下问题:一个表中有几条需要提示记录时,既有即将到期的记录,也有已过期的记录时,只提示已过期的记录,不提示即将到期的记录

要实现:一个表有多条需要提醒的记录,既有即将到期的,也有已过期的时,要分别提醒。有即将到期的记录,提示即将到期;有过期的记录,提示已过期,不能再重复提示即将到期。
如何解决这个问题?谢谢
[此贴子已经被作者于2018/10/23 7:48:27编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/10/23 9:06:00 [只看该作者]

Dim dt4 As Date = Date.Today.AddDays(30)
Dim dtdq As Date = Date.Today

Dim dr20 As String= DataTables("安全资格培训").GetComboListString("企业名称", "下次培训日期 >= #" & dtdq & "# and 下次培训日期 <= #" & dt4 & "#")
Dim dr21 As String= DataTables("安全资格培训").GetComboListString("企业名称", "下次培训日期 < #" & dtdq & "#")
If dr21 > "" Then
    MessageBox.Show(dr21 & ":" & vbcrlf & "    企业负责人/安全员培训合格证已过期未复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
End If
If dr20 > "" Then
    MessageBox.Show(dr20 & ":" & vbcrlf & "    企业负责人/安全员培训合格证即将到期复审","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If


 回到顶部