473,548 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ 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 2376
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.au...

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.au...

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
4295
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
4256
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 Agency Types, then the 2nd combo box displays a list of Organisations, depending upon the Agency Type Selected. The first combo box 'ctlType'...
6
3539
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. In the After Update Event of the combo box field how can I tell if the field value was selected from open combo box or typed in by the user? ...
2
2156
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 placed before the combo in taborder, and is there only so the focus will go someplace other than the combo box when the form is displayed. In the form...
3
3634
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" through "Phase 10" (there are 10 Phases I want to sort from) Once the phase has been selected a second combo box would populate.
9
6746
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 second combo to change depending on what values the user selects in the first box, it's just that every time the user changes the first combobox, the...
2
2433
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 populate the combo (for a list of 2500). Can anybody optimize the code. I tried Duffs devise instead of 'for loop', but no improvement.
6
3669
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
7028
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 database I wrote for home, the combo boxes and listboxes no longer display the bound column. For example, on a form I have a combo box based on a...
0
7512
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7438
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7707
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6036
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5082
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1926
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 we have to send another system
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.