Populating a listbox with multiple values on one line

wrkoutbeef

New Member
Joined
Jan 9, 2015
Messages
1
Here is the code I have, I looking like it works, but it get suck in an endless loop of some kind, not from the do while. It looks like it is how I have set up the ListBox. Help

Set dbs = CurrentDb
Me.ListBoxVich.RowSource = " "
Me.ListBoxVich.ColumnCount = 6
Me.ListBoxVich.ColumnWidths = "500;1500;300;1700;500"
Set rst = dbs.OpenRecordset("Select [AutoSchedule].AutoYear, " & _
" [AutoSchedule].AutoMakeModel, " & _
" [AutoSchedule].AutoType, " & _
" [AutoSchedule].AutoVin," & _
" [AutoSchedule].CostNew " & _
"From [AutoSchedule] " & _
"Where [AutoSchedule].AutoDistNumb = " & SelectedDistNumber & "" & _
"And [AutoSchedule].AutoPlanYear = " & SelectedYear & ";")

If rst.EOF Then
Me.ScrMessage = "Unable to find an Auto Record"
Else
Do While Not rst.EOF
ListItem = rst.Fields(0) & " ; " & rst.Fields(1) & " ; " & rst.Fields(2) & " ; " & rst.Fields(3) & " ; " & rst.Fields(4)
Me.ListBoxVich.AddItem ListItem
Me.ScrMessage = ListItem
rst.MoveNext
Loop
End If
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,215,039
Messages
6,122,799
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top