Updating a sub-form based on a list box selection

被刻印的时光 ゝ 提交于 2019-12-07 18:42:53

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/14977779/updating-a-sub-form-based-on-a-list-box-selection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!