Foxtable(狐表)用户栏目专家坐堂 → [讨论]筛选


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

主题:[讨论]筛选

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


加好友 发短信
等级:小狐 帖子:350 积分:2933 威望:0 精华:0 注册:2015/4/23 19:53:00
[讨论]筛选  发帖心情 Post By:2015/11/3 14:50:00 [只看该作者]

 


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

 

当我选择图片里面的三项是出现运行错误“#”附近有语法错误,选择其它任何条件都可以

 

以下是代码,请大师帮我看一下。谢谢

 

Dim nms() As String = {"客户","品牌","款号","PO号","加工厂","日期起","日期止"}
Dim sps() As String = {"'","'","'","'","'","#","#"}
Dim bjf() As String = {" = "," = "," = "," = "," = "," >= "," <= "}
Dim fds() As String = {"客户","品牌","款号","PO号","加工厂_工厂","订单交期","订单交期"}
Dim Filter As String
For i As Integer = 0 To nms.length -1
    If e.Form.Controls(nms(i)).Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & fds(i) & bjf(i) & sps(i) & e.Form.Controls(nms(i)).Value & sps(i)
    End If
Next
' ===========以下是生产状态============
Dim scs() As String = {"车间A组","车间B组","车间C组","外发生产","外发工艺"}
For Each sc As String In scs
    If e.Form.Controls("车间A组").Checked = True ' 如果付款状态选择了"车间A组"
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工厂_工厂 = '车间A组'"
    End If
   
    If e.Form.Controls("车间B组").Checked = True
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工厂_工厂 = '车间B组'"
    End If
   
    If e.Form.Controls("车间C组").Checked = True
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工厂_工厂 = '车间C组'"
    End If
   
    If e.Form.Controls("外发生产").Checked = True
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工厂_负责人 is not null"
    End If
   
    If e.Form.Controls("外发工艺").Checked = True
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "特殊工艺_名称 <> '无'"
    End If
Next
'  ===========以上是生产状态============

 

 

''  ============以下是订单状态=============
Dim sys() As String = {"生产中订单","已注销订单","全部订单"}
For Each sy As String In scs
   
    Dim scz As WinForm.RadioButton = e.Form.Controls("生产中订单")  ' 如果选择了生产中的订单
    If scz.checked = True Then  '判断有没有选中
        DataTables("生产进度表").LoadFilter = "注销 = 0"  '选中执行加载生产进度表的注销为false
    End If
   
    Dim yjx As WinForm.RadioButton = e.Form.Controls("已注销订单")
    If yjx.checked = True Then
        DataTables("生产进度表").LoadFilter = "注销 = 1"
    End If
   
    Dim qian As WinForm.RadioButton = e.Form.Controls("全部订单")
    If qian.checked = True Then
        DataTables("生产进度表").LoadFilter = Filter
    End If
Next

DataTables("生产进度表").Load
' ============以上是订单状态=============
Tables("生产进度表").Filter = Filter


 


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


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

msgbox看一下弹出什么。

 

如果你的是sqlserver数据库,要把#改成单引号'才行


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


加好友 发短信
等级:小狐 帖子:350 积分:2933 威望:0 精华:0 注册:2015/4/23 19:53:00
  发帖心情 Post By:2015/11/3 15:28:00 [只看该作者]

谢谢您   把#改掉就行了   

 回到顶部