473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Combo Box / Label Help

risk32
98
Hello all.
I seem to have a problem displaying the correct value in a label for a combobox.
In my table, I have a primary key (1-12) and a second column (January - December). Pretty self-explanitory. I have the combobox set to filter by primary key in ascending order, to make sure the months stay in the same format, instead of being alphabetical. Everything is A-OK, except one thing. With the onChange event for the combobox, I have a label that displays a caption, based on what the value of the box is. When the value changes, it displays the primary key when I want it to show the second field (the text of the month).
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboMonth_Change()
  2. lblMonthLink.Caption = cboMonth.Value
  3. End Sub
Does anyone know how to change it to show the second column in the caption instead of the primary?
Nov 3 '08 #1
2 2770
FishVal
2,653 Expert 2GB
Hello, risk32.

Use "Column" property of Combobox class.

Regards,
Fish
Nov 3 '08 #2
missinglinq
3,532 Expert 2GB
Since the columns are Zero-based the second column is actually Column 1

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboMonth__AfterUpdate()
  2.   lblMonthLink.Caption = cboMonth.Column(1)
  3. End Sub
You'll also notice that I changed the code to the AfterUpdate event. Using the OnChange event will work if you users scroll to an item to select it, but if they try to use the AutoExpand feature, i.e. type in a letter or two so that Access will search out matches, then hit >Enter> ro select it, it'll fail.

Linq ;0)>
Nov 3 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Kent Eilers | last post by:
I want to follow naming conventions for my controls - i usually prefix combo boxes with "cbo". When a form is in datasheet view however i do not want the user to see the 'cbo' prefix in front of...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
10
by: Bob Darlington | last post by:
I am using the following SQL as a RowSource for a combo box on a form. "SELECT LAN, TenantName as , ShopNum as FROM qTenantSelect " The field 'ShopNum' is a text field and has a caption...
7
by: Doug | last post by:
Hi I have a combo box (A) that populates a following combo box (B) based on a selection. The selection from the first combo box (A) initiates an OleDbDataAdapter routine that extracts the...
3
by: shannonlolley | last post by:
I have an aspx page with a combo box on it. The combo box items are displayed as text from left to right with no spaces between items. I believe I have seen this posted in a previous post, but I...
9
by: Mark | last post by:
I am encountering a problem with the combo box. This only happens when using the datasource property, I create a table with the following values (a, b, c, d). Step 1. Select the "c" value from...
2
by: Michael Kintner | last post by:
I have a combo box the three columns. After the combo box has been selected how can I get the data from the third column but show only the first column after selected. Example: Combo box drop...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
3
by: =?Utf-8?B?TWlrZSBPS0M=?= | last post by:
The text in my combo box is longer than the control can show, when I click on the down arrow, I can see the whole text, but when I select one of the items, the text box of the combo box shows the...
2
by: MicaK | last post by:
Good Morning, I am new to this forum, and extremely new to VBA, so there may be a very simple explanation to this. I also apologize if I am giving you and excessive amount of detail. I have a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.