选择表单的特定记录
在这个表单上,我创建了一个网格,几乎看起来像一个条形图,其中有按月堆叠的小“单元格”。每个“单元格”都是方形子表单,我创建了用作子表单的小方形表单。
所以我想知道的是,运行选择查询并且仅处理该查询中的特定记录的代码(VB)是什么?例如,这些像“单元格”一样的小表单中的每一个都会成为子表单,代表一个组织,如果我运行第 N 个查询,我会通过任何方式获得第 10 个顶级商店......所以我们的想法是使用每个小表格代表该查询中的每条记录。因此,对于第一个单元格,我想运行 SELECT 查询,获取结果,并仅处理第一条记录。然后在第二个表单上运行完全相同的查询,并仅处理第二条记录,依此类推!
我想这有点奇怪,但它会给他们他们想要的东西,我唯一不确定的部分是“准确定义我想在 VBA 中使用的记录”
On this form, I create a grid, almost looks like a bar chart with little "cells" stacked by month. Each of these "cells" are square sub forms, and I create the little square forms that I use as the sub forms.
So what I wanted to know is, what is the code (VB) for running a select query, and only working with specific records within that query? For example, each one of these little "cell" like forms that become the sub-forms, represent a organization, and if I run a top Nth query I get the 10 Top store by whatever....so the idea is to use each little form as a representative of each record from that query. So for the first cell I want to run the SELECT query, get the results, and work only with the first record. Then on the second form, run the exact same query, and work only with the second record, and so on!
Its a little weird I suppose, but it will give them exactly what they want, and the only part I am not sure about, is the "defining exactly which record I want to use in the VBA"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以更改每个子表单的 SQL 来读取:
或者,看到您已经有了一个有点奇怪的设置,您可以使用记录集将每个 ID 写入 10 个隐藏文本框控件之一,并使用每个文本框作为链接主字段,ID 作为子表单的链接子字段。
链接主字段和链接子字段是子表单控件的属性,而不是所包含的表单的属性。
替代文本 http://ltd.remou.com/linkchildlinkmaster.png
You could change the SQL for each sub form to read:
Or, seeing you already have a somewhat odd set-up, you can write each ID to one of 10 hidden textbox controls using a recordset, and use each of these textboxes as the link master field with ID as the link child field for the subforms.
Link Master Field and Link Child Field are properties of the subform control, not the form contained.
alt text http://ltd.remou.com/linkchildlinkmaster.png
如果我正确理解你的请求,你可以做这样的事情。
表结构
VBCode
If i understand your request correctly yuo can do something like this.
Table Structure
VBCode
您将 SQL 语句视为伪表的定义,即可以像操作表一样操作的一组记录 (RecordSet)。
上面的代码应该会给你一个好的开始。
You treat the SQL statement as the definition of a pseudoTable, i.e. a set of records (RecordSet) that you can manipulate as if it was a table.
The above code should give you a good start.