Computing.Net > Forums > Office Software > Combo Box in Access

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Combo Box in Access

Reply to Message Icon

Name: Martyn999
Date: August 24, 2004 at 15:49:44 Pacific
OS: XP Pro SP1
CPU/Ram: XP1700+ / 512MB
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Mark Long
Date: August 24, 2004 at 16:21:05 Pacific
Reply:

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


0

Response Number 2
Name: Martyn999
Date: August 25, 2004 at 00:26:59 Pacific
Reply:

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...


0

Response Number 3
Name: Mark Long
Date: August 25, 2004 at 05:25:42 Pacific
Reply:

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


0

Response Number 4
Name: Martyn999
Date: August 30, 2004 at 05:37:45 Pacific
Reply:

In the end I used cboName.Text = cboName.ItemData(0)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Office on Mulitple Comput... Cannot save files to E dr...



Post Locked

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


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Combo Box in Access

Clearing combo boxes in access www.computing.net/answers/office/clearing-combo-boxes-in-access/5413.html

Alignment a text vertical in Access www.computing.net/answers/office/alignment-a-text-vertical-in-access/3485.html

Linking two combo boxes in Excel www.computing.net/answers/office/linking-two-combo-boxes-in-excel/2900.html