troubleshooting Question

Access use multi column ListBox on popup form to load multicolumn source combobox

Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft Access
4 Comments1 Solution57 ViewsLast Modified:

I am using the following code behind a button click to open a form whose code is shown further on. This loads a listbox on the form.
When the user makes a selection from the listbox it sends this back to my original ComboBox.
The listbox has one column. I now want to do this for a multi column combobox and listbox. How do I do that?

Private Sub btnManufacturer_Click()

    oForm = Me.Name
    oCombo = Me.Manufacturer_Combo.Name
    DoCmd.OpenForm "f_List", , , , , acDialog

End Sub

Private Sub Form_Open(Cancel As Integer)

  Cancel = -1
  CopyComboBoxSettings Forms(oForm).Form.Controls(oCombo)

  Cancel = 0

End Sub

Private Sub CopyComboBoxSettings(ByVal CSourceComboBox As Access.ComboBox)

  List1.RowSourceType = CSourceComboBox.RowSourceType
  List1.RowSource = CSourceComboBox.RowSource
  List1.ColumnCount = CSourceComboBox.ColumnCount
  List1.ColumnWidths = CSourceComboBox.ColumnWidths

End Sub

Private Sub List1_Click()
    Forms(oForm).Form.Controls(oCombo).value = List1.value
End Sub
John Tsioumpris
IT Supervisor
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros