filling a two column listbox from a two column recordset

D

Dennis

Is there a way to fill a two column listbox on a userform
from a SQL recordset? I want the user to be able to make
multiple selections from this listbox. And then I want to
write an update SQL back to a table.

Thank you in advance, Dennis
 
D

Dennis

Tom,

Thank you. However, I'm having trouble with filling the
second column. My two fields fill in the first column.

Any ideas?

Dennis
 
T

Tom Ogilvy

Do Until rstEmployees.EOF
with UserForm1
.ComboBox1.AddItem rstEmployees!lName
.Combobox1.List(.combobox1.Listcount-1,1) = rstEmployees!fName

' To use a ListBox control, use the following statement instead
' of the one above:
' UserForm1.ListBox1.AddItem rstEmployees!lName
'
' If the ComboBox or ListBox is on a worksheet instead of
' a UserForm, reference the worksheet instead of the UserForm:
' ActiveSheet.ComboBox1.AddItem rstEmployees!lName
rstEmployees.MoveNext
Loop
 
T

Tom Ogilvy

Left out the End With

Do Until rstEmployees.EOF
with UserForm1
.ComboBox1.AddItem rstEmployees!lName
.Combobox1.List(.combobox1.Listcount-1,1) = rstEmployees!fName
End with
 
D

Dennis Brininger

Tom,

Thank you very much for helping me. I got it to work
before your last note. I really do appreciate your quick
response - sorry I'm late getting back.

Dennis
 
Top