Adjustable Listbox

  • Thread starter Hoardling via AccessMonster.com
  • Start date
H

Hoardling via AccessMonster.com

I am looking at creating an adjustable listbox. What this means if I have a
small amount of data in the listbox I don't want a large white space after
the data. When the data starts filling in then the listbox will grow. At
some point the listbox will reach a max size, in which the scroll bars will
be used afterwards. I set the size, Height. Any ideas or thoughts on this?
I know the white space isn't really a big deal, but I am going for looks here.
 
G

Guest

You can adjust the Height property of the List Box. The problem is, it is
not an exact science. It will take some experimenting to get the value
correct. I would suggest a value per row approach. Use the control's
ListCount property to determine how many rows it has. The example below
assumes the maximum number of rows is 12.

With Me.MyListBox
If .ListCount > 12 Then
.Height = 2700
Else
.Height = .ListCount * 270
End If
End With


Forms!frmclientsearch!lstclient.height = 270 *
forms!frmclientsearch!lstclient.listcount
 
H

Hoardling via AccessMonster.com

Thanks for the information. I will try it.
You can adjust the Height property of the List Box. The problem is, it is
not an exact science. It will take some experimenting to get the value
correct. I would suggest a value per row approach. Use the control's
ListCount property to determine how many rows it has. The example below
assumes the maximum number of rows is 12.

With Me.MyListBox
If .ListCount > 12 Then
.Height = 2700
Else
.Height = .ListCount * 270
End If
End With

Forms!frmclientsearch!lstclient.height = 270 *
forms!frmclientsearch!lstclient.listcount
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top