Combo box to only display first letter of selection

spectraflame

Well-known Member
Joined
Dec 18, 2002
Messages
830
Office Version
  1. 365
Platform
  1. Windows
I would like to be able to create a combo box that displays only the first character of the text in the field from a specific table.

Currently my combo box is looking at a specific column in a table and showing me the full text. I have tried the LEFT("Classification",1) but I cannot seem to get that to work.

Is there a better way?

Thanks,
Matthew
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
How about creating a query from the table and do the calculation in a calculated field. Then use this query as the source from your form, and use the calculated field.
 
Upvote 0
I tried the following:

Created a query that returned all of the values of the Classification field with the following statement.

Expr1: Left([Classification],1)

When I run the query, it works great, but when I reference the query from the combo box, the drop down list is blank?

Any suggestions?
Matthew
 
Upvote 0
I think you misunderstood what I was saying. I wasn't saying to use query in the combo box.

Instead of using the table as the Source of your Form, use this new query as the Control Source of your Form (obviously, in addition to this calculation, you will need to add all the fields you want to display in the query also - or simply add all the fields from the table to the query).

Then, create your combo box from the calculated field.
 
Upvote 0
If I understand correctly now, I would have to create a new query that would return all of the values that I need to display on this form from every table or other query that I have already defined? This sounds like a great deal of effort to me.

What about adding a new column to the Classification table that would allow for manual entry of the desired letter or better yet have code that would populate the first character based on the word in the Classification Description field?

I will think on this a little more.
Thanks,
Matthew
 
Upvote 0
Matthew

What are you trying to do this for?

What purpose are you going to use the 1st letter for?
 
Upvote 0
I have no idea on the structure of your database, so I cannot say what is best.

However, if the Control Source of your form is simply a table, it is pretty easy. All you have to do is create a new query, select the table, click on the "*" to add all fields from your table to your query all at once, then add your calculated field. Save the query. Then open your form and change the Control Source of the Form from the table to a query.

If the Control Source of the Form is already a query, it is even easier, as then you only need to add the calculation to the existing query.

Now, if you have numerous forms that are using this type of combo box, I can see your point in having to create a query for each one. However, each one shouldn't take too long if you follow the steps I outlined.
 
Upvote 0
The purpose for just the first letter is to save on space and is what management has requested.
 
Upvote 0
But what is the purpose of the combobox?

What is it used for, not what it displays?

Is it just to abbreviate the Classification?
 
Upvote 0
It is just used to abbreviate the classification to a single character.
 
Upvote 0

Forum statistics

Threads
1,221,893
Messages
6,162,659
Members
451,780
Latest member
Blake86

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top