Foxtable(狐表)用户栏目专家坐堂 → [求助] 请教任务栏的代码问题。


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

主题:[求助] 请教任务栏的代码问题。

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


加好友 发短信
等级:六尾狐 帖子:1425 积分:11332 威望:0 精华:0 注册:2008/9/1 22:20:00
[求助] 请教任务栏的代码问题。  发帖心情 Post By:2013/3/27 18:39:00 [只看该作者]

今天试了一下做任务栏,代码来自帮助,略作修改,只要把代码嵌入Select Case 语句就没了反应,单独运行则一切正常。

代码如下,请高手指点:

 

Select Case e.Link.Name
    Case "今天生日员工"
        Dim nms As String      
        For Each dr As DataRow In DataTables("基本信息").DataRows
            Dim dt As Date = dr("出生日期")
                If dt.Month = Date.Today.Month AndAlso dt.Day = Date.Today.Day Then
                    nms = nms & ",'" & dr("姓名") & "'"
                End If
        Next
                If nms > "" Then
                    nms = nms.Trim(",")
                    Tables("基本信息").filter = "[姓名] In (" & nms &")"
               End If
                Forms("正式工信息").Open
                MainTable = Tables("基本信息")
    Case "本周生日员工"
        Dim ids As String
        Dim n As Integer = 6
            For Each dr As DataRow In DataTables("基本信息").DataRows
                Dim dt As Date = dr("出生日期")
                Dim dt1 As New Date(Date.Today.Year,dt.Month,dt.Day)
                Dim dt2 As  New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day)
                    If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then
                        ids = ids & ",'" & dr("工号") & "'"
                    End If
            Next
            If ids > "" Then
                ids = ids.Trim(",")
                Tables("基本信息").filter = "[工号] In (" & ids &")"
           End If
                Forms("正式工信息").Open
                MainTable = Tables("基本信息")


    End Select


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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/3/27 19:53:00 [只看该作者]

MessageBox.show("名称是:" & e.Link.Name)
Select Case e.Link.Name
    Case "今天生日员工"
         MessageBox.show("今日")
        Dim nms As String
        For Each dr As DataRow In DataTables("基本信息").DataRows
            Dim dt As Date = dr("出生日期")
            If dt.Month = Date.Today.Month AndAlso dt.Day = Date.Today.Day Then
                nms = nms & ",'" & dr("姓名") & "'"
            End If
        Next
        If nms > "" Then
            nms = nms.Trim(",")
            Tables("基本信息").filter = "[姓名] In (" & nms &")"
        End If
        Forms("正式工信息").Open
        MainTable = Tables("基本信息")
    Case "本周生日员工"
        MessageBox.show("本周")
        Dim ids As String
        Dim n As Integer = 6
        For Each dr As DataRow In DataTables("基本信息").DataRows
            Dim dt As Date = dr("出生日期")
            Dim dt1 As New Date(Date.Today.Year,dt.Month,dt.Day)
            Dim dt2 As  New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day)
            If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then
                ids = ids & ",'" & dr("工号") & "'"
            End If
        Next
        If ids > "" Then
            ids = ids.Trim(",")
            Tables("基本信息").filter = "[工号] In (" & ids &")"
        End If
        Forms("正式工信息").Open
        MainTable = Tables("基本信息")
    Case Else
        MessageBox.show("名称不符,罢工了")
End Select
        
       

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


加好友 发短信
等级:六尾狐 帖子:1425 积分:11332 威望:0 精华:0 注册:2008/9/1 22:20:00
  发帖心情 Post By:2013/3/27 20:27:00 [只看该作者]

眼都看花了,没想到居然是这个原因,还得细心呀...
谢谢狐爸指点。

 回到顶部