Updating a sub-form based on a list box selection

Cromulent picture Cromulent · Feb 20, 2013 · Viewed 10.4k times · Source

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?

Answer

Fionnuala picture Fionnuala · Feb 20, 2013

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.