Loop through single-select listbox

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
 
W

Wayne Morgan

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.
 

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