Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AUTOselect in LISTBOX

Status
Not open for further replies.

Compuboy

Programmer
Jun 8, 2004
38
US
When the form is opened I want the first item in the list box to be selected and highlighted...you can do this with a combo box but what would I need to type (Under Private Sub Form_Open) to do this with a list box??

THANKS
 
Perhaps in the on load event of the form, try:

[tt]me("lstMyList").selected(0) = True[/tt]

(should you display column heads, try 1 in stead of 0)

Roy-Vidar
 
it works except..after I open the form and the first thing is selected...it will not let me select anything else.
 
That's probably to do with some properties of the listbox (enabled/locked (or forms allow edits false?), not updateable controlsource...)

Roy-Vidar
 
When I put this code in Form_Open:

Me("ListBox").Selected(0) = True

It does select the first item..however, after I cannot switch the selected item...everything just gets locked.
 
I think there are two alternatvies in my second reply here thread702-995936. A third alternative could be

[tt]me!cboMyCombo.value = me!cboMyCombo.column(0,0)[/tt]

- should the bound column be the first column.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top