Foxtable(狐表)用户栏目专家坐堂 → [求助]这个代码出现这个是什么情况,错在哪里?


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

主题:[求助]这个代码出现这个是什么情况,错在哪里?

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


加好友 发短信
等级:童狐 帖子:238 积分:1838 威望:0 精华:0 注册:2014/7/1 8:56:00
[求助]这个代码出现这个是什么情况,错在哪里?  发帖心情 Post By:2014/8/5 15:26:00 [只看该作者]

'选定你所要选定的区域,筛选代码你可以参照老六的窗口列子的筛选代码
Dim Filter As String
With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing Then
        Filter = "车辆基本情况_车牌号码 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "车辆基本情况_车牌颜色 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox2")
    If .Value IsNot Nothing Then
        Filter = "处理环节 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox3")
    If .Value IsNot Nothing Then
        Filter = "处罚情况_案件状态 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox4")
    If .Value IsNot Nothing Then
        Filter = "处理方式 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("DateTimePicker1")
    If .Value   IsNot   Nothing   Then
        If Filter >""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "违章基本情况_违章时间 >= #" & .Value &   "#"
    End   If
End  With
With e.Form.Controls("DateTimePicker2")
    If .Value   IsNot   Nothing   Then
        If Filter >""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "违章基本情况_违章时间 <= #" & .Value &   "#"
    End   If
End  With

'筛选后全部选定区域
With Tables("车辆违章表")

    .Select(0,0, .Rows.Count - 1, .Cols.Count - 1)

End With

'打印代码
Dim Book As New XLS.Book(ProjectPath & "Attachments\违章车辆统计报表.xls") '打开模板
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build() '生成细节区
Book.Save("D:\release\reports\违章车辆统计报表.xls") '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = "D:\release\reports\违章车辆统计报表.xls"
Proc.Verb = "Print" '加上这个可以直接打印,去掉只能预览
Proc.Start()

 

 

 


图片点击可在新窗口打开查看此主题相关图片如下:捕获.png
图片点击可在新窗口打开查看

 


 


图片点击可在新窗口打开查看此主题相关图片如下:捕获1.png
图片点击可在新窗口打开查看

 回到顶部
总数 12 1 2 下一页