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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count number of records in a listbox

Status
Not open for further replies.

mrsbean

Technical User
Jul 14, 2004
203
US
I have several listboxes which are filled based on the selection which is made in the last listbox. When there is only one avalable option in the listbox, I want it to be automatically selected, and then to move on to the fill the next listbox which depends on its value. How can I do this?

MrsBean
 
Nevermind ... found it. Me.MyListBox.ListCount will count the records.
 
Me again ... that only answered part of my question. In the event that there is only one record in the listbox, how do I make it automatically selected?

 
Try
[tt]if me!lstMyList.listcount = 1 then
me!lstMyList.selected(0)=true
end if[/tt]

If you're showing column heads, try
[tt]if me!lstMyList.listcount = 2 then
me!lstMyList.selected(1)=true
end if[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top