Foxtable(狐表)用户栏目专家坐堂 → 大红袍老师:帮我看一下签到表打印加载哪儿出了问题?


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

主题:大红袍老师:帮我看一下签到表打印加载哪儿出了问题?

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


加好友 发短信
等级:一尾狐 帖子:498 积分:4611 威望:0 精华:0 注册:2013/4/25 8:02:00
大红袍老师:帮我看一下签到表打印加载哪儿出了问题?  发帖心情 Post By:2015/6/14 16:26:00 [只看该作者]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:签到表加载问题.rar

 

大红老师:请您帮我审查一下签到表打印加载的问题,基本思路是得到FILTER后,对这个进行OR 和 AND 划分,得到的数组分别给到短日期,起始时间,教室三个变量中,再进行筛选,但总是报错,不知哪出问题?

 

请指导


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


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

DataTables("考试数据表").LoadFilter = ""
DataTables("考试数据表").Load

Dim nms As String() = {"短日期","起始时间","教室"} '指定生成目录树的各列
Dim qts As String() = {"'","'","'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim trv As WinForm.TreeView = e.Form.Controls("签到单时间")
Dim filter As String
For Each nd As object In trv.AllNodes
    If nd.Level > 2 Then
        If nd.Checked  Then
            Dim rts() As String = nd.FullPath.Split("\")
            Dim val As String = ""
            For i As Integer = 1 To rts.length - 1
                If val > "" Then
                    val = val & " And "
                End If
                val = val & nms(i-1) & " = " & qts(i-1) & rts(i) & qts(i-1)
            Next
            If filter > "" Then
                filter = filter & " Or (" & val & ")"
            Else
                filter = val
            End If
        End If
    End If
Next

filter = filter.Replace("(","").Replace(")","")

msgbox(filter)

DataTables("考试数据表").ResumeRedraw
DataTables("考试数据表").StopRedraw
For Each ary() As String In DataTables("考试数据表").GetValues("短日期|起始时间|教室", filter)
   
    Vars("qdd1") = ary(0)
   
   
    Vars("qdd2") = ary(1)
   
   
    Vars("qdd3") = ary(2)
   

   
   
    With Tables("考试数据表")
        .Filter = "机考安排 is null and 短日期 = '" & ary(0) & "' and 起始时间 = '" & ary(1) & "' and 教室 = '" & ary(2) & "'"
        If .Rows.count > 0 Then
            .Select(0,0,.Rows.count - 1,.Cols.count - 1 )
            Dim Book As New XLS.Book(ProjectPath & "Attachments\纸考签到单.xls")
            Dim fl As String = ProjectPath & "Reports\纸考签到表\" & ary(0) & " "  & ary(1).Replace(":", "点") &  " "  &  ary(2) & "签到单.xls"
            Book.Build() '生成细节区
            Book.Save(fl) '保存工作簿
        End If
    End With
   
   
    With Tables("考试数据表")
        .Filter = "机考安排 is not null and 短日期 = '" & ary(0) & "' and 起始时间 = '" & ary(1) & "' and 教室 = '" & ary(2) & "'"
        If .Rows.count > 0 Then
            .Select(0,0,.Rows.count - 1,.Cols.count - 1 )
            Dim  book = New XLS.Book(ProjectPath & "Attachments\机考签到单.xls")
            Dim fl = ProjectPath & "Reports\机考签到表\" & ary(0) & " "  & ary(1).Replace(":", "点") &  " "  &  ary(2) & "签到单.xls"
           
            Book.Build() '生成细节区
            Book.Save(fl) '保存工作簿
        End If
    End With
   
   
   
Next                                      '结束遍历value2s的数组
DataTables("考试数据表").ResumeRedraw


 回到顶部