列表框中多选查询-Victor Duane
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> Access数据库-窗体/数据页


列表框中多选查询

发表时间:2007/10/18 12:13:28 评论(0) 浏览(7685)  评论 | 加入收藏 | 复制
   
摘 要:列表框中多选查询
正 文:
列表框中多选查询
'******************** Code Start ************************
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String
Set frm = Form!frmMyForm
Set ctl = frm!lbMultiSelectListbox
strSQL = "Select * from Employees where EmpID="
'Assuming long EmpID is the bound field in lb
'enumerate selected items and
'concatenate to strSQL
For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & " or EmpID="
Next varItem

'Trim the end of strSQL
strSQL=left$(strSQL,len(strSQL)-12))
'******************** Code end ************************

Access软件网交流QQ群(群号:198465573)
 
 相关文章
列表框多项选择并输入到另一列表框  【点燃一支烟  2009/7/16】
【access小品】列表框多选复制  【todaynew  2010/6/13】
列表框之间相互转移记录示例  【红尘如烟  2011/1/19】
【Access源码示例】Access列表框多选打印  【漏蛧尐魚℡  2012/4/20】
上海通用维修站信息小工具\列表框联动\列表框与主窗体联动  【xinwei  2012/5/2】
列表框多选示例  【网行者  2012/5/7】
常见问答
技术分类
相关资源
文章搜索
关于作者

Victor Duane

文章分类

文章存档

友情链接