根据列表框选择更新子表单 [英] Updating a sub-form based on a list box selection

查看:77
本文介绍了根据列表框选择更新子表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我想说的是,我已经阅读了与此类似的其他问题,但是它们不能解决问题.

我有一个包含子表单的表单.主表单仅具有一个列表框,该列表框显示表中的所有条目(尽管仅显示表中的三个字段),而子表单旨在显示与该列表框中选择的记录关联的所有数据. /p>

我已将链接主字段"和链接子字段"设置为ClientID(该表用于提供客户端信息).当我第一次打开主窗体时,子窗体在列表框中显示第一项的数据,但是当我在列表框中选择其他项时,子窗体不会更新.我尝试使用Requery VBA方法,但没有成功.

有人没有任何暗示吗?

解决方案

将链接主字段设置为列表框的名称.确保列表框返回客户端ID.

例如

 Row Source : SELECT ClientID, ClientName FROM Table
 Bound Column : 1
 Column Count : 2

 Link Master Fields : MyListBox
 Link Child Fields  : ClientID

现在,当用户从列表框中选择一个客户端时,子窗体将更新为该客户端的数据.

First of all I want to say that I have read other questions similar to this one but they don't solve the issue.

I have a form which contains a sub-form. The master form simply has a list box which displays all the entries in a table (only showing three fields from it though) and the sub-form is designed to show all the data associated with the record that is selected in the list box.

I have set the Link Master Fields and Link Child Fields to be ClientID (the table is for client information). When I first open the master form the sub-form displays the data for the first item in the list box but when I select a different item in the list box the sub-form does not update. I have tried using the Requery VBA method but without much success.

Does anyone have any hints at all?

解决方案

Set the link master field to the name of the listbox. Ensure that the listbox returns a Client ID.

For example

 Row Source : SELECT ClientID, ClientName FROM Table
 Bound Column : 1
 Column Count : 2

 Link Master Fields : MyListBox
 Link Child Fields  : ClientID

Now, when the user selects a client from the listbox, the subform will update to data for that client.

这篇关于根据列表框选择更新子表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆