Logo

My Access Tips for Custom Microsoft Access

Application Development

by Matthew V Carmichael


Need Help?

My Tips


Links

Resources
Quick Tip Details
Question:
Automatically Fill controls based on users selection from a combobox or listbox.
Answer:
Ensure the additional fields are savable in the combobox/listbox. The can be hidden by setting the column width to 0 for the appropriate column if desired. On the After Update event of the combobox/listbox, use the column property to retrieve the desired value (the first column is 0 – not 1).
Code:
Private Sub YourCombobox_AfterUpdate()
    Me.[Your Textbox 1] = Me.YourCombobox.Column(1)
    Me.[Your Textbox 2] = Me.YourCombobox.Column(2)
End Sub