List box not showing all records

K

Kevin

When I open a form and select a record from a list box, I
can not scroll to last record in the query. If I open a
form and scroll to the bottom of the list before I make a
selection all records will be available.
Does anyone know how to make all records available
without having to scroll first?
 
K

Ken Snell

You can "force" the listbox to load all records in the form's OnOpen event:

Private Sub Form_Open(Cancel As Integer)
Dim lngCBOCount As Long
On Error Resume Next
' Initialize the listbox's records
lngCBOCount = Me.ListBoxName.ListCount
End Sub
 
Top