Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox ItemData

Do comboboxes in Excel have an ItemData? I'm populating a combobox fro
a database and need to tie the record's UID to what's displayed in th
box.

Do I have to use multiple columns in the combobox to do this? And jus
hide that column maybe?

I know VBA pretty well, just have never used it in Excel before.

Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Combobox ItemData

Do comboboxes in Excel have an ItemData? I'm populating a combobox from
a database and need to tie the record's UID to what's displayed in the
box.


No. Unfortunately MSForms combo box controls lack this feature.

Do I have to use multiple columns in the combobox to do this? And just
hide that column maybe?


That's the easiest way to accomplish the same thing.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox ItemData

Thank you, Rob.

For some reason I didn't get notified by email when you posted this, s
I didn't see it until I checked the post just now.

So I'm taking the route of using multiple columns. When looping throug
a recordset to populate the combobox, how do I refer to a specifi
column?

Here's what I tried:

UserForm1.cboAccount.ColumnCount = 2
UserForm1.cboAccount.ColumnWidths = "2,0"

Do Until rs.EOF
UserForm1.cboAccount.column(0) = rs!acct_name
UserForm1.cboAccount.column(1) = rs!acct_id
'UserForm1.cboAccount.ListIndex = rs!acct_id
rs.MoveNext
Loop

But I think that's only for loading arrays. Is there a simple way t
load the two columns for each line?

Thanks

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox ItemData

Okay- disregard that last question. I figured it out:

Do Until rs.EOF
With UserForm1.cboAccount
.AddItem rs!acct_name
.List(.ListCount - 1, 1) = rs!acct_id
End With
rs.MoveNext
Loop

Thanks

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox ItemData

Okay- disregard that last question. I figured it out:

Do Until rs.EOF
With UserForm1.cboAccount
.AddItem rs!acct_name
.List(.ListCount - 1, 1) = rs!acct_id
End With
rs.MoveNext
Loop

Thanks

--
Message posted from http://www.ExcelForum.com

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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
COMBOBOX smiley New Users to Excel 1 October 12th 05 02:01 PM
VBA ComboBox Stromma Excel Programming 2 February 23rd 04 11:22 PM
combobox scrabtree[_2_] Excel Programming 4 October 16th 03 04:10 PM
Combobox Scott Excel Programming 2 July 23rd 03 02:49 PM


All times are GMT +1. The time now is 01:49 AM.

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"