0
votes

I'm working on a project in Access 2010 where I am creating a form with a subform. On the side of my form I have a Listbox control which I would like to update with the FirstName of person information records entered into my subform. Additionally I would like the Listbox to be clickable for easy navigation of my users so they can simply click on a persons name and have it load the record into the subform. Is there an easy way to accomplish this, or am I doomed to use VBA? If so I would really like some assistance. Sample code would be a life saver.

To provide some context, here are some sample tables:

Families (ID, LastName, HomeAddress, City, State, Zip)
People (ID, FirstName, FamilyID, Phone, Email)

Requirements:

  • The Listbox called "All Members" should display all family members for the current FamilyID
  • Should auto-update upon each newly added family member
  • Should load the subform upon clicking a FirstName with that person's data

Here are some pictures of the Form/Subform & select Properties to help with understanding my goals :)

enter image description hereenter image description here

For the last several hours I've been trying to find an answer for this prior to coming here. You will help me more than you know. Thank you so much to whoever can help me solve this question ;)

1

1 Answers

1
votes

It is perfectly possible to do this with no coding at all. Make sure that the bound column of the listbox is FamilyID and that FamilyID is in the recordet of the subform control form (contents), then set the subform control properties like so (note: control, not contents)

Link Master Fields :  NameOfListBox
Link Child Fields  :  FamilyID

Further Information re Comment

Recordset is not a property, it is a word that you are going to come across regularly if you continue to work with Access.

I misread your requirements, it is People.ID that needs to be the bound column so:

Listbox : FamilyMembers

Data Tab
RowSource : SELECT People.ID, People.FirstName FROM People         
            WHERE (((People.FamilyID)=[Forms]![Families]![ID])) 
            ORDER BY People.FirstName;

Bound Column  : 1

Format Tab
Column Count  : 2
Column Widths : 0cm;2.54cm

Subform Control

Link Master Fields : FamilyMembers
Link Child Fields  : ID

Form of Subform Control

Record Source : SELECT [People].[ID], [People].[FirstName], etc FROM [People]