以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何在筛选时,随机变动列名  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=191431)

--  作者:zhangchi96
--  发布时间:2024/4/16 17:56:00
--  如何在筛选时,随机变动列名
Dim 截止年度 As WinForm.Label = Forms("岗位统计分析窗体").Controls("截止年度框")
Dim 截止月份 As WinForm.Label = Forms("岗位统计分析窗体").Controls("截止月份框")
Dim 列名称 As String
If 截止月份.text <= 9 Then
     列名称 = “聘任岗位” & "0" & 截止月份.text
else
      列名称 = “聘任岗位” & 截止月份.text
End If
Dim Filter1 As String = " 年度 = "& dr("年度") &" and 数据类型 = \'期初数\' "    \'设置条件
Filter1 = Filter1 & " and 列名称 is not null "        \'设置条件
Tables("弹窗窗体_岗位聘任年初年底名册").Filter = Filter1

请问其中倒数第2句中, 列名称  这样表示对吗?

--  作者:zhangchi96
--  发布时间:2024/4/16 19:06:00
--  
想起来了,可能是这样,不知道对不对?(用&来连接)

Filter1 = Filter1 & " and “ & 列名称 ”  & “ is not null "        \'设置条件
--  作者:有点蓝
--  发布时间:2024/4/16 20:26:00
--  
Filter1 = Filter1 & " and " & 列名称   & " is not null "