以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  多值字段如何统计  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=153553)

--  作者:zyxhx
--  发布时间:2020/8/14 15:34:00
--  多值字段如何统计

Dim nms() As String = {"xinmin","qsdate","jsdate","CheckedComboBox1"}
Dim sps() As String = {"\'","#","#","\'"}
Dim bjf() As String = {" = "," >= "," <= "," = "}
Dim fds() As String = {"医生姓名","收款日期","收款日期","项目名称"}
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
If filter > "" Then
    Tables("门诊医生工作量明细").filter = filter
End If

 

请问老师:假设以上代码中“医生姓名”和“项目名称”为多值字段,控件使用了复先组合框,代码应该如何修改?


--  作者:有点蓝
--  发布时间:2020/8/14 15:39:00
--  
特殊的内容需要另外处理,
……
    If e.Form.Controls("医生姓名").value IsNot Nothing Then
        If filter > "" Then
            filter =  filter & " and "
        End If
        filter = filter & " 医生姓名 in (\'" & e.Form.Controls("医生姓名").value.replace(",","\',\'") & "\')"
    End If
If filter > "" Then
    Tables("门诊医生工作量明细").filter = filter
End If

--  作者:zyxhx
--  发布时间:2020/8/14 16:44:00
--  

感谢老师!