473,480 Members | 3,062 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Combo Box Problem ...


I have a Combo Box, named "cbo", on a "Form" variable named "f",
and, on "cbo", "Bound Column" is set to "1", "Column Count" to
"1", "Row Source Type" to "Value list" and, "Row Source" to "a;b;c",
so, if the following code works as expected, "x" should be set to "a",
"b" then "c" on each iteration of the loop:

Dim x, i as Integer
....
For i = 1 To f!cbo.ListCount
f!cbo = i
x = f!cbo.column(0)
Next i

However, on actually runnung the code, I find that "x" remains as the null
string
(""), so something's going wrong, but what is it?

Russell
Nov 12 '05 #1
3 2370
The combo can have the values a, b, or c.
Your code attempts to give it the values 1, 2, and 3.

Try setting it to ItemData(i).
From memory it's zero-baesd, so start the loop at zero.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Russell Potter" <rpotter AT iinet DOTnet DOT au> wrote in message
news:3f**********************@freenews.iinet.net.a u...

I have a Combo Box, named "cbo", on a "Form" variable named "f",
and, on "cbo", "Bound Column" is set to "1", "Column Count" to
"1", "Row Source Type" to "Value list" and, "Row Source" to "a;b;c",
so, if the following code works as expected, "x" should be set to "a",
"b" then "c" on each iteration of the loop:

Dim x, i as Integer
...
For i = 1 To f!cbo.ListCount
f!cbo = i
x = f!cbo.column(0)
Next i

However, on actually runnung the code, I find that "x" remains as the null
string
(""), so something's going wrong, but what is it?

Russell

Nov 12 '05 #2

Allen,

Thanks _very_ much for that info; I modified the code accordingly and it
works fine now ...

The reason I had set the combo box to 1, 2 and 3 is that I'd had it in my
head from somewhere that setting the combo box itself (rather than one of
it's properties) to a number would set the row of the combo box, but I was
obviously mistaken on that count, and "ItemData" must be the way to do it
instead

Sorry for wasting everyone's time ... :-)

Russell
The combo can have the values a, b, or c.
Your code attempts to give it the values 1, 2, and 3.

Try setting it to ItemData(i).
From memory it's zero-baesd, so start the loop at zero.

Nov 12 '05 #3
Russell, no apology is needed, friend.

Your question was clear and concise, and you are very welcome.
Glad to know it's working for you now.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Russell Potter" <rpotter AT iinet DOTnet DOT au> wrote in message
news:3f**********************@freenews.iinet.net.a u...

Allen,

Thanks _very_ much for that info; I modified the code accordingly and it
works fine now ...

The reason I had set the combo box to 1, 2 and 3 is that I'd had it in my
head from somewhere that setting the combo box itself (rather than one of
it's properties) to a number would set the row of the combo box, but I was
obviously mistaken on that count, and "ItemData" must be the way to do it
instead

Sorry for wasting everyone's time ... :-)

Russell
The combo can have the values a, b, or c.
Your code attempts to give it the values 1, 2, and 3.

Try setting it to ItemData(i).
From memory it's zero-baesd, so start the loop at zero.

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4282
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
4
4241
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of...
6
3536
by: Support4John | last post by:
a2k (9.0.6926) SP-3 Jet 4.0 SP-7 I have a form with combo box field that allows the user to select from the combo box or type in the field value that may or maynot be in the combo box field. ...
2
2144
by: Jeff Mason | last post by:
I'm observing some strange behavior when I use a bound combo box in conjunction with the combo's anchor property. I define a form which contains just a textbox and a combo box. The text box is...
3
3621
by: hmiller | last post by:
Hey everyone, I am having a hell of a time trying to set this menu system up. Here's what I'm trying to do. Combo Box One; is populated by names under properties "row source" "Phase 1"...
9
6740
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
2
2427
by: kiranmn75 | last post by:
I want to dynamically populate a combo box through javascript. Data is coming from a array. Sometimes data list may contain items in excess of 2000. Explorer takes more than 5 seconds to...
6
3666
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
7012
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small...
0
7055
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7060
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7022
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4501
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3004
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.