Loop through single-select listbox

  • Thread starter Thread starter Razor
  • Start date Start date
R

Razor

Hi,

I have bought an Access library that can send reports to
PDF with a filename and filepath assigned through code so
it doesn't prompt the user.

Now I need to loop through a listbox generating one PDF
for each item in the listbox. The listbox should be
Multi-select = None
for the rest of my code to work.

I tried this but it didn't work:
For Each Item In Me.lstReportClient
...
Next Item

How do I frame the loop?

Thanks,
Razor
 
Try a For..Next loop.

Here is one example.

Dim I As Integer
If lstFamilyPosition.ListCount = 0 Then Exit Sub
For I = 0 To lstFamilyPosition.ListCount - 1
ValueOfRow = Me.lstFamilyPosition.Column(1, I)
Next I

Replace the number 1 with the number for the column you want to pull the
value from. The column number is zero based, so the first column is 0, the
second is 1, etc. The row number is also zero based.
 
Back
Top