Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共9 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请问如何查询多值字段

1楼
foxstudent 发表于:2012/2/7 20:22:00

我有一个姓名列是多值字段,在查询窗口中我发现,不能查询出包含其中一个姓名行,请问该怎么写代码?谢谢

With e.Form.Controls("Textbox")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "姓名 like '" & .Value & "'"
    End If
End With

2楼
czy 发表于:2012/2/7 20:35:00

要加上*号,如:

Filter = Filter & "姓名 like '*" & .Value & "*'"

3楼
foxstudent 发表于:2012/2/7 21:31:00
谢谢c版!
4楼
实话实说 发表于:2012/2/8 9:11:00

能否在一个文本框中查询多个值.比如[性名]列中,我要筛选出姓刘的和姓李的,  刘,李

5楼
狐狸爸爸 发表于:2012/2/8 9:19:00

用Like运算符号:

 

http://www.foxtable.com/help/topics/0102.htm

 

6楼
实话实说 发表于:2012/2/8 10:21:00

不明白,帮忙写一下吧,表A窗口

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目6.table

7楼
czy 发表于:2012/2/8 10:56:00
Tables("表A").Filter = "[姓名] In ('A2','A5')"
8楼
czy 发表于:2012/2/8 11:07:00

窗口按钮中这样试试

 

Dim Filter As String = e.Form.Controls("姓名").Value
If Filter > "" Then
    If Filter.Contains(",") Then
        Filter = "'" & Filter.Replace(",","','") & "'"
        Tables("表A").Filter = "[姓名] In (" & Filter & ")"
    Else
        Tables("表A").Filter = "[姓名] = '" & Filter & "'"
    End If
End If

9楼
实话实说 发表于:2012/2/8 11:34:00
以下是引用czy在2012-2-8 11:07:00的发言:

窗口按钮中这样试试

 

Dim Filter As String = e.Form.Controls("姓名").Value
If Filter > "" Then
    If Filter.Contains(",") Then
        Filter = "'" & Filter.Replace(",","','") & "'"
        Tables("表A").Filter = "[姓名] In (" & Filter & ")"
    Else
        Tables("表A").Filter = "[姓名] = '" & Filter & "'"
    End If
End If

测试通过,谢谢CZY

共9 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .07813 s, 3 queries.