以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  法定假期  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=142010)

--  作者:良才
--  发布时间:2019/10/16 14:24:00
--  法定假期
老师下面代码,能循环吗?
Dim y As Integer = Date.Today.Year
Dim d As Date =  New Date(y,08,01)
Dim d1 As Date =  Date.Today
If d1 >= d Then
    dr = DataTables("法定假期").SQLFind("名称 = \'中秋\' And 日期 > #"& d &"#")
    If dr Is Nothing Then
        MessageBox.Show("没有输入【中秋假期】,请检查")
    Forms("窗口1").Open()
    End If
    dr = DataTables("法定假期").SQLFind("名称 = \'国庆\' And 日期 > #"& d &"#")
    If dr Is Nothing Then
        MessageBox.Show("没有输入【国庆假期】,请检查")
    Forms("窗口1").Open()
    End If
    dr = DataTables("法定假期").SQLFind("名称 = \'元旦\' And 日期 > #"& d &"#")
    If dr Is Nothing Then
        MessageBox.Show("没有输入【元旦假期】,请检查")
    Forms("窗口1").Open()
    End If
End If
[此贴子已经被作者于2019/10/16 14:26:31编辑过]

--  作者:有点蓝
--  发布时间:2019/10/16 14:29:00
--  
If d1 >= d Then
dim str() as string = {"中秋","国庆","元旦"}
for each s as string in str
    dr = DataTables("法定假期").SQLFind("名称 = \'" & s & "\' And 日期 > #"& d &"#")
    If dr Is Nothing Then
        MessageBox.Show("没有输入【" & s & "假期】,请检查")
    End If
next
endif

--  作者:良才
--  发布时间:2019/10/16 14:33:00
--  
谢谢!老师