filling a two column listbox from a two column recordset
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 |
filling a two column listbox from a two column recordset
http://support.microsoft.com/default...61&Product=xlw
XL2000: How to Use ADO to Return Data to a ListBox or ComboBox -- Regards, Tom Ogilvy "Dennis" wrote in message ... 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 |
filling a two column listbox from a two column recordset
Tom,
Thank you. However, I'm having trouble with filling the second column. My two fields fill in the first column. Any ideas? Dennis -----Original Message----- http://support.microsoft.com/default.aspx?scid=kb;en- us;244761&Product=xlw XL2000: How to Use ADO to Return Data to a ListBox or ComboBox -- Regards, Tom Ogilvy "Dennis" wrote in message ... 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 . |
filling a two column listbox from a two column recordset
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 -- Regards, Tom Ogilvy "Dennis" wrote in message ... Tom, Thank you. However, I'm having trouble with filling the second column. My two fields fill in the first column. Any ideas? Dennis -----Original Message----- http://support.microsoft.com/default.aspx?scid=kb;en- us;244761&Product=xlw XL2000: How to Use ADO to Return Data to a ListBox or ComboBox -- Regards, Tom Ogilvy "Dennis" wrote in message ... 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 . |
filling a two column listbox from a two column recordset
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 -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... 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 -- Regards, Tom Ogilvy "Dennis" wrote in message ... Tom, Thank you. However, I'm having trouble with filling the second column. My two fields fill in the first column. Any ideas? Dennis -----Original Message----- http://support.microsoft.com/default.aspx?scid=kb;en- us;244761&Product=xlw XL2000: How to Use ADO to Return Data to a ListBox or ComboBox -- Regards, Tom Ogilvy "Dennis" wrote in message ... 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 . |
filling a two column listbox from a two column recordset
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 -----Original Message----- 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 -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... 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 -- Regards, Tom Ogilvy "Dennis" wrote in message ... Tom, Thank you. However, I'm having trouble with filling the second column. My two fields fill in the first column. Any ideas? Dennis -----Original Message----- http://support.microsoft.com/default.aspx?scid=kb;en- us;244761&Product=xlw XL2000: How to Use ADO to Return Data to a ListBox or ComboBox -- Regards, Tom Ogilvy "Dennis" wrote in message ... 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 . . |
All times are GMT +1. The time now is 01:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com