Link to home
Start Free TrialLog in
Avatar of DaveRoehrman
DaveRoehrmanFlag for United States of America

asked on

Can I use cboBox.Column(1) to place an initial value in a ComboBox?

I am using the following line to place text into a combo box as the form opens.  Column(0) of the combo box is formatted for text.

Me!cboAccountSelect = "Select an Account"        (works fine)
Me!cboAccountSelect.Column(0) = "Select an Account"       (does not work)

I want to display the same text in a combo box whose column(0) has Integer format, and whose column(1) is text.  The following line does not work.  Is there ANY way to accomplish this?

Me!cboAccountSelect.Column(1) = "Select an Account"       (does not work)
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Are you trying to choose an entry from the combobox or are you trying to add text to the combo?

Avatar of DaveRoehrman

ASKER

I am trying to add text.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I gather from these comments that I can better spend my time conforming to the statndard method, and to accept that this control is designed to start out blank.  I appreciate your time very much.
DaveRoehrman,

There is absolutely nothing wrong with a combobox having a default value.

The issue here is three-fold.
1. Depending on the configuration of the combobox, it may not be easy to add a "Display" value, without having a corresponding "Bound Column" Value.
2. The "Interface" considerations I mentioned above.
3. Lastly becaues the combobox can display values as well as let a user enter them.
(as opposed to a listbox that will just display values.)

Like everything in life, there are no "Absolutes". ("You should never do this.", or "You should always do that.")
There are exceptions to every rule.
As Pete will tell you, Design guidelines change every few years or so as technology changes.
Knowing when to break the rules is the key.
;-)
I use the Microsoft "Options" dialog box in many programs as my reference.
You will see that none of the comboboxes display "Instructions", like:
 "Select a ..."
(Screenshots attached)

My general rule is that I look at other professional applications/interfaces.
If I don't ever see the interface I need ever used, I will try not to invent it.
:-)

As I said, I have seen what you are asking for in "TextBoxes" in some web apps.
But a textbox is designed for data entry.
You can have a combobox that simply displays values, and lets you select from among them.

Lastly, and what I should have added to my post, is that what I have stated is my "Opinion", not any universal rule.
;-)

JeffCoachman
untitled01.JPG
Just FYI:
To make the default value of a combobox, the "first" value in the list, you can use something like this in the Default value property of the combobox:
=[YourCombobox].[ItemData](0)
Or this in VBA:
Me.YourCombobox.DefaultValue = Me.YourCombobox.ItemData(0)

;-)

Jeff
Jeff, I greatly appreciate the complimentary "service after the sale".  It went a long way to clear up what was for me a cloudy issue.
LOL!

Someimes I get confused as well:
BoundColumns, Column(0) or Column(1), LimitToList, NotInList, Table/Query, ValueList,...ect
;-)

Jeff