MSAccess:从一对多关系中选择一行
在MS Access 2010中,我有TableA与TableB一对多相关,TableB与TableC一对多相关。 TableC 有 1 个数字字段和 1 个日期字段(除了查找字段之外)。
FormA 的数据源是连接 TableA 和 TableB 的选择查询。我想向 FormA 添加一个额外的只读字段,其中包含 TableC 中最新日期行中的数字字段。
执行此操作的最佳方法是什么?我是否应该在 TableB 中创建一个字段并创建一个更新查询(或宏?)来在连接查询运行之前填充该列?
谢谢。
In MS Access 2010, I have TableA related one-to-many to TableB, and TableB related one-to-many to TableC. TableC has one numeric field and one date field (in addition to the lookup field).
FormA's datasource is a select query that joins TableA and TableB. I want to add one additional read-only field to FormA that contains the numeric field from TableC from the row with the most recent date.
What's the best way to go about doing this? Should I create a field in TableB and create an update query (or macro?) that populates that column prior to the join query running?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个表单,您需要只读,因此 DlookUp 应该适合:http://support.microsoft.com/ kb/208786
OP的编辑有两个问题,第一个是它表明
date
是一个可接受的字段名称,它是一个保留字,不应该使用。其次,它表明 DlookUp 中需要方括号,但实际上不需要。或者:
This is a form and you require read only, so DlookUp should suit : http://support.microsoft.com/kb/208786
There are two problems with the edit by the OP, the first is that it suggests that
date
is an acceptable field name, it is a reserved word and should not be used. Secondly, it suggests that square brackets are needed in DlookUp, they are not.Alternatively: