Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multi Column ComboBox
Is there a way to make a ComboBox show 2 columns and fill them with info
from a database? I have looked at a bunch of examples and have sucessfully created a 2 column listbox and tried using that as a launching point for a 2 column combo box. I can't seem to get it figured out. Here is the code I came up with so far. Thanks in advance for your suggestions. Steve Private Sub CommandButton2_Click() Dim intColumnCount As Integer Dim conn As ADODB.Connection Dim rsPlot As ADODB.Recordset Set conn = New ADODB.Connection With conn .Provider = "SQLOLEDB.1" .ConnectionString = _ "Password=XXXXXX;Persist Security Info=True;User ID=structural;Initial Catalog=Advantage; Data Source=ACCOUNT" conn.Open End With ' Select the data. Set rsPlot = conn.Execute("SELECT Advantage.dbo.CLA.claAddressee,Advantage.dbo.CLA.c laCity FROM Advantage.dbo.CLA Order By Advantage.dbo.CLA.claAddressee") Do While Not rsPlot.EOF ComboBox1.List(intColumnCount, 0) = rsPlot!claAddressee ComboBox1.List(intColumnCount, 1) = rsPlot!claCity rsPlot.MoveNext intColumnCount = intColumnCount + 1 Loop End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to find a value with multi-column, multi-record list | Excel Worksheet Functions | |||
Excel VBA Multi Column ComboBox | Excel Discussion (Misc queries) | |||
match in multi-column and multi-row array | Excel Discussion (Misc queries) | |||
why can't I additem to multi-column this way.. | Excel Programming | |||
Extract values from a multi-select multi-column list-box | Excel Programming |