Multi-Column ComboBox DefaultValue

I have a combobox with 2 columns. When its form is displayed. I want it's text value to already have a default in it, but I'm not sure what the delimiter is. With one column the defaultvalue could be (ex. "Hello") but with two - doing (ex. "Hello"; "World") does not put "Hello" in the first column and "World" in the next.
tyy8Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
JimMorganConnect With a Mentor Commented:
Want to select a comment as the answer?  Click the message on the right side of the comment line.

You're welcome, tyy8.  Glad I could be of help.

Jim
0
 
BrianWrenCommented:
Is this combo bound to the recordsource of the form?  Where dow it get the information that is in the drop-down list?

Brian
0
 
tyy8Author Commented:
its recordsource is a sql statement
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
BrianWrenCommented:
What is the SQL?
0
 
tyy8Author Commented:
I think your taking the details of the situation far, far away from the question.

How do you fill the combobox's text value if it has two columns in it??

The recordsource doesn't matter.
0
 
jschrismanCommented:
A combo box can only have 1 bound column. It only displays the first visible column from the dropdown box in the control.

Your best bet is to make the sql query for the combo box concatenate the two columns into one. Make that one column the first visible.
0
 
BrianWrenCommented:
OK, here's where I was going.

You cannot fill a combo box period.  All it has is its rowsource.

You can, however, position a combo box.

If there is a row in the rowsource of your combo box that has "Hello" in one column, and "World" in the other column, OF THE SAME ROW, then you can position the box on that row.

How that would be done depends intimately on how the rows are getting their data, hence the focus on the details.

Brian
0
 
JimMorganCommented:
tyy8:  I see where all the confusion is going on.  As I see it you want the combo box to default to a certain value.

If the combo box is bound, the default will only occur when you go to a new record.  If the default value is not one of the existing values in the combo box, it will not allow that setting unless the first field in the group is the bound field.  If the value does not exist and the not in list property is true, it will fuss that the value is not in the list.

Here are the scenarios:

If the default value is in the list, great!  You only need to have the first column in the default property.  That is what the field represents.  Forget the second value.  If you drop down the box, it will show up.

If the default value is not in the list and not-in-list is no, then there is no problem.

Same as last scenario but not-in-list is true, then you would have to create an union query with the first and second column values hand entered in the union query.  You still only need to have the first column value in the default box.

Jim
0
 
tyy8Author Commented:
Jim's correct, that works. Thanks to everyone.
0
All Courses

From novice to tech pro — start learning today.