MS Access 2007 - 循环浏览列表框中的值以获取 SQL 语句的 ID
假设我有两个表,一个用于事务,另一个表的主键是第一个表中的外键,这种关系只是将位置与事务相关联。
我有一个带有列表框的表单,显示所有潜在位置,以便用户可以打开一些仅与给定位置相关的仪表板表单。所以我知道如何将数据从选择传递到仪表板,但是我现在希望用户能够从第一个列表中选择多个位置。
因此,如果我使用 SQL 语句,WHERE 子句就像这样
.... WHERE LocationID = " & me.lstLocations.value & ";"
,但是我如何将这种类型的方法等同于选择多个选项呢?我确信有某种类型的循环我没有注意到。
谢谢 贾斯汀
Lets say I have two tables, one for transactions, and another table who's primary key is the foreign key in the first table, and this relationship simply associates locations to transactions.
I have a form with a list box that shows all the potential locations, so that the user can open some dashboard forms that only pertain to a given location. So I know how to pass the data from the selection to the dashboard, however I would now like the user to have the capability to select multiple locations from the first list.
so if I use a SQL statement the WHERE clause is like
.... WHERE LocationID = " & me.lstLocations.value & ";"
but how would I equate this type of method to selecting multiple choices? I am sure there is some type of loop that escapes me.
Thanks
Justin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
可以像这样获取列表:
这是数字列表,字符串列表需要引号。
You can use
The list can be obtained like so:
This is for a numeric list, a list of strings needs quotes.