Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default why can't I additem to multi-column this way..

hi,

Why is it that I can't populate a combobox the following way:

Sheet1.ComboBox2.List(intRow, 1) = RS.Fields("test01").Value
Sheet1.ComboBox2.List(intRow, 2) = RS.Fields("test02").Value
RS.MoveNext
I got this idea based on the Help file from Excel 2003
I have defined the number of Column = 2

i tried Dick Kusleika way, without problem:
Sheet1.ComboBox2.AddItem RS.Fields("test01").Value
Sheet1.ComboBox2.List(Sheet1.ComboBox2.ListCount - 1, 1) =
RS.Fields("test02").Value

thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default why can't I additem to multi-column this way..

Because additem increases the size of list, where your method doesn't.

--
Regards,
Tom Ogilvy


"augustus" wrote in message
...
hi,

Why is it that I can't populate a combobox the following way:

Sheet1.ComboBox2.List(intRow, 1) = RS.Fields("test01").Value
Sheet1.ComboBox2.List(intRow, 2) = RS.Fields("test02").Value
RS.MoveNext
I got this idea based on the Help file from Excel 2003
I have defined the number of Column = 2

i tried Dick Kusleika way, without problem:
Sheet1.ComboBox2.AddItem RS.Fields("test01").Value
Sheet1.ComboBox2.List(Sheet1.ComboBox2.ListCount - 1, 1) =
RS.Fields("test02").Value

thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default why can't I additem to multi-column this way..

Is there other way to AddItem to multi-column, such as

Sheet1.ComboBox2.AddItem RS.Fields("test01").Value & ";" &
RS.Fields("test02").Value

I read this somewhere on the web, it didn't specify as a method for VBA, but
for VB.
I tried, but doesn't work

Thanks

"Tom Ogilvy" wrote:

Because additem increases the size of list, where your method doesn't.

--
Regards,
Tom Ogilvy


"augustus" wrote in message
...
hi,

Why is it that I can't populate a combobox the following way:

Sheet1.ComboBox2.List(intRow, 1) = RS.Fields("test01").Value
Sheet1.ComboBox2.List(intRow, 2) = RS.Fields("test02").Value
RS.MoveNext
I got this idea based on the Help file from Excel 2003
I have defined the number of Column = 2

i tried Dick Kusleika way, without problem:
Sheet1.ComboBox2.AddItem RS.Fields("test01").Value
Sheet1.ComboBox2.List(Sheet1.ComboBox2.ListCount - 1, 1) =
RS.Fields("test02").Value

thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default why can't I additem to multi-column this way..


I've always avoided dual column list or combos since I could never ge
them to work quite right. Maybe I'll take this on as a quest...

In any case, another issue you may be having is that the columns ar
zero based, so your original (non-working) code would read somethin
like:

Sheet1.ComboBox2.List(intRow, 0) = RS.Fields("test01").Value
Sheet1.ComboBox2.List(intRow, 1) = RS.Fields("test02").Value
RS.MoveNext

I think the answer to your question is that the combo and list boxe
begin at zero-length and require you to add a row before doing anythin
with that row. Kind of like an undimensioned array (i.e. Dim sStuff())
You cannot write to sStuff(1) before you ReDim the array and tell i
how much memory to use.

I could be way off base, but that's how I think of it.



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26835

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default why can't I additem to multi-column this way..

No. that would put both values in the first column.

--
Regards,
Tom Ogilvy


"augustus" wrote in message
...
Is there other way to AddItem to multi-column, such as

Sheet1.ComboBox2.AddItem RS.Fields("test01").Value & ";" &
RS.Fields("test02").Value

I read this somewhere on the web, it didn't specify as a method for VBA,

but
for VB.
I tried, but doesn't work

Thanks

"Tom Ogilvy" wrote:

Because additem increases the size of list, where your method doesn't.

--
Regards,
Tom Ogilvy


"augustus" wrote in message
...
hi,

Why is it that I can't populate a combobox the following way:

Sheet1.ComboBox2.List(intRow, 1) = RS.Fields("test01").Value
Sheet1.ComboBox2.List(intRow, 2) = RS.Fields("test02").Value
RS.MoveNext
I got this idea based on the Help file from Excel 2003
I have defined the number of Column = 2

i tried Dick Kusleika way, without problem:
Sheet1.ComboBox2.AddItem RS.Fields("test01").Value
Sheet1.ComboBox2.List(Sheet1.ComboBox2.ListCount - 1, 1) =
RS.Fields("test02").Value

thanks






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
match in multi-column and multi-row array sloth Excel Discussion (Misc queries) 14 September 1st 06 10:33 PM
Multi-column Combo Box Kitty[_2_] Excel Programming 2 December 22nd 03 09:12 PM
Extract values from a multi-select multi-column list-box Peter[_20_] Excel Programming 5 September 28th 03 04:04 PM
Multiple Column ComboBox using Additem Jimmi Excel Programming 2 September 24th 03 02:40 AM


All times are GMT +1. The time now is 10:27 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"