在 Access 子表单中选择一条记录
我在 Access 2003 中有一个窗体,其中包含 2 个子窗体。第一个位于数据表视图中,只有 2 个字段:SiteID 和 SiteName,因此父表单中的一条记录包含多个站点的列表。第二个子表单与第一个子表单具有相同的数据源,但在单一表单视图中,因此它以单一表单显示一个网站的所有网站字段。我的想法是,我在左侧有一个站点名称列表,然后我想单击其中一个并让其 OnCurrent 事件过滤右侧的子表单,以显示该记录中的所有字段(针对该站点)。
这似乎是一件相当简单的事情,但我无法弄清楚什么代码(docmd.gotorecord?,过滤器?,以编程方式更改子表单查询然后重新查询等)是最好使用的......以及如何制作它实际上工作。
任何帮助表示赞赏。
I have a form in Access 2003 that contains 2 subforms. The first is in datasheet view and is only 2 fields, SiteID and SiteName, so a list of many sites for one record in the parent form. The second subform is the same datasource as the first, but in single form view, so it shows all the site fields for one site in a single form. The idea being that I have a list of the site names on the left and I want to then click on one and have its OnCurrent event filter the subform on the right to show all the fields in that record (for that site).
This seems like a fairly simple thing to do but I can't figure out what code (docmd.gotorecord?, filter?, programatically change the subforms query and then requery etc) is the best to use... and how to make it actually work.
Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 Northwind 示例数据库 (NWind.mdb) 中的“客户订单”表单,该数据库随 Access 的每个版本一起提供,也可以下载 http://www.microsoft.com/downloads/details.aspx?familyid=c6661372-8dbe-422b-8676-c632d66c529c& ;displaylang=en
我想你会发现它能满足你的需求。
Have a look at the Customer Orders form in the Northwind sample database (NWind.mdb) that ships with every version of Access or can be downloaded http://www.microsoft.com/downloads/details.aspx?familyid=c6661372-8dbe-422b-8676-c632d66c529c&displaylang=en
I think you will find it does what you want.