Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a combo box that is automatically filled with a list of client names when the form is opened. The only probem is, the text of the combo box (what you see before you drop it down) is always blank when it is first opened before selecting something from the list. Is there any way of getting the first value of the box displayed as the text of the box? Usually you would use the code:
cboNames.ListIndex=1
But this doesnt work as in Access the ListIndex property is read only. Is there any other way of doing this so I can have the first value displayed?
Cheers

It's not the ListIndex method you want it's the Text. Try cboNames.Text = "Client Name" would display Client Name in the cbo box.
Regards
M

what i ned to do though is display the first item of the combo box as the text. so say the first name in the box was "Bob", i would want Bob displayed, likewise for David, George etc...

I am not sure exactly what code you want but you could ask on the programming forum. The command cboName.Text relates to the text that is going to be displayed in the combo box, so if you put cboName.Text = "Bob" you will see Bob, however this will then mean you will have 2 Bob's, one in the display and one in the drop down. Each of your name choices obviously select other criteria eg if you selected Bob it might show Bob's address elsewhere in the display. I would have thought if using VB6 there would be a way to use a default value for the combo, you need the same but for VBA. I was going to suggest trying
cboName.Text = cboName.ListIndex "1"
but I do not think this is right, I am not a programmer but will have a go, stick a post on programming pointing to your post here in Office Software.
Regards
M

![]() |
Office on Mulitple Comput...
|
Cannot save files to E dr...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |