Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find a value with multi-column, multi-record list Dallasm Excel Worksheet Functions 1 May 30th 10 05:40 PM
Excel VBA Multi Column ComboBox jlclyde Excel Discussion (Misc queries) 3 October 15th 09 04:21 PM
match in multi-column and multi-row array sloth Excel Discussion (Misc queries) 14 September 1st 06 10:33 PM
why can't I additem to multi-column this way.. augustus Excel Programming 4 October 13th 04 04:30 AM
Extract values from a multi-select multi-column list-box Peter[_20_] Excel Programming 5 September 28th 03 04:04 PM


All times are GMT +1. The time now is 09:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"