Foxtable(狐表)用户栏目专家坐堂 → [求助] 单选框筛选问题


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

主题:[求助] 单选框筛选问题

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


加好友 发短信
等级:婴狐 帖子:7 积分:208 威望:0 精华:0 注册:2016/2/29 17:10:00
[求助] 单选框筛选问题  发帖心情 Post By:2016/4/9 11:03:00 [只看该作者]

进销存统计页面 希望输入搜索框的内容和切换单选框   窗口的table可以给出筛选的内容,求助高人,感激
窗口AfterLoad代码为:
Dim hcrk As new SQLJoinTableBuilder("入库明细查询","耗材_入库明细")
hcrk.C
hcrk.AddTable("耗材_入库明细","药品代码","门诊药房信息","代码")
hcrk.AddTable("耗材_入库明细","入库单号","耗材_入库单据","入库单号")
hcrk.AddExp("药品编号","代码")
hcrk.AddExp("名称","药品名")
hcrk.AddExp("类型","分类")
hcrk.AddCols("规格","单位","数量")
hcrk.AddExp("单价","{耗材_入库明细}.进价")
hcrk.AddExp("金额","数量*{耗材_入库明细}.进价")
hcrk.AddExp("厂家信息","{耗材_入库明细}.生产厂家")
hcrk.AddExp("单据编号","{耗材_入库明细}.入库单号")
hcrk.AddCols("入库日期","审核日期","审核人","入库方式")
hcrk.AddExp("入库仓库","仓库编号")
hcrk.AddCols("供应商")
hcrk.AddExp("备注","{耗材_入库明细}.备注")
hcrk.Build()
MainTable = Tables("入库明细查询")
'Tables("耗材入库查询汇总_入库明细查询").Fill(hcrk.BuildSql,"zfrj",True)

查询点击事件为:
Dim Filter As String
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        Filter = "入库仓库 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "入库方式 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox3")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = 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
If e.Form.Controls("RadioButton1").Checked = True ' 如果点击状态选择了"按入库单"
    If Filter >"" Then
        Tables("入库单").Filter = Filter
    End If
End If
If e.Form.Controls("RadioButton2").Checked = True ' 如果点击状态选择了"按明细"
    If Filter >"" Then
        Tables("耗材入库查询汇总_入库明细查询").Filter = Filter
    End If
End If
If e.Form.Controls("RadioButton3").Checked = True ' 如果点击状态选择了"按明细汇总"
    If Filter >"" Then
       Tables("入库明细汇总").Filter = Filter
    End If
End If
If e.Form.Controls("RadioButton4").Checked = True ' 如果点击状态选择了"按供应商"
    If Filter >"" Then
      Tables("入库供应商").Filter = Filter
    End If
End If




此主题相关图片如下:qq截图20160409110106.png
按此在新窗口浏览图片
[此贴子已经被作者于2016/4/9 11:35:57编辑过]

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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/4/9 11:39:00 [只看该作者]

具体什么问题,出什么错?

Dim Filter As String = "1=1 "
With e.Form.Controls("ComboBox1")
    If .Text IsNot Nothing Then
        Filter = Filter & " and 入库仓库 = '" & .Text & "'"
    End If
End With
With e.Form.Controls("ComboBox2")
    If .Text IsNot Nothing Then
        Filter = Filter & " and 入库方式 = '" & .Text & "'"
    End If
End With
With e.Form.Controls("ComboBox3")
    If .Text IsNot Nothing Then
        Filter = Filter & " and 供应商 = '" & .Text & "'"
    End If
End With
With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        Filter = Filter & " and 入库日期 >= #" & .Text & "#"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    If .Value IsNot Nothing Then
        Filter = Filter & " and 入库日期 <= #" & .Text & "#"
    End If
End With
If e.Form.Controls("RadioButton1").Checked = True ' 如果点击状态选择了"按入库单"
    Tables("入库单").Filter = Filter
End If
If e.Form.Controls("RadioButton2").Checked = True ' 如果点击状态选择了"按明细"
    Tables("耗材入库查询汇总_入库明细查询").Filter = Filter
End If
If e.Form.Controls("RadioButton3").Checked = True ' 如果点击状态选择了"按明细汇总"
    Tables("入库明细汇总").Filter = Filter
End If
If e.Form.Controls("RadioButton4").Checked = True ' 如果点击状态选择了"按供应商"
    Tables("入库供应商").Filter = Filter
End If

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


加好友 发短信
等级:婴狐 帖子:7 积分:208 威望:0 精华:0 注册:2016/2/29 17:10:00
  发帖心情 Post By:2016/4/9 12:22:00 [只看该作者]

点击查询  没有反映 


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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/4/9 14:27:00 [只看该作者]

msgbox(Filter)看条件,核对这个条件有没有数据。

另外筛选的是主表,窗口表有对应主表吗

 回到顶部