Navigate a List Box

  • Thread starter Thread starter Bob Barnes
  • Start date Start date
B

Bob Barnes

Upon clicking a Button, I'd like to goto the first record in a list box, run
code, then go to the second record, run code..until the last entry in the
List Box has code run...similar to a Do Loop.

Doable??

TIA - Bob
 
Bob

That sounds like ... a Do Loop! Are you saying you do NOT want to use VBA
to do this? I can envision having Access loop through a recordset, running
the same procedure on each record.

If you provide a bit more specific information, it may be that folks here
can offer alternate approaches...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Jeff - I wound-up doing a Do - Loop, and sending PDFs (using Stephen's great
code..thank you Stephen) thru Lotus Notes.

Thought it would be cool to highlight each row in the List Box as the code
ran...similar in a Subform running from top to last record.

Thank you - Bob
 
You can loop through the listbox, get data from the list, do something in
your code, loop until you reach the end of the list in the listbox.

dataColumn = 0 (or column for your listbox)
For dataRow = 1 to listbox.ListCount-1
tmpvalue = listbox.column(dataColumn,dataRow)
(your code ......)
Next dataRow
 
Sounds good. While the code I wrote yesterday is fine, I'll add this to my
"toolbox" and give it a try.

Thank you - Bob
 
Here is the cool thing you want :) ,to highlight each row in the List Box as
the code
ran:

1) Change your listbox's Multi-Select property to Extended

2) use the following code to do the highlight

dataColumn = 0 (or column for your listbox)
For dataRow = 1 to listbox.ListCount-1
listbox.Selected(dataRow) = true '<-Highlight the current row by
selecting it
tmpvalue = listbox.column(dataColumn,dataRow)
(your code ......)
listbox.Selected(dataRow) = false '<-turn off the highlight when you
are done with it
Next dataRow

its cool !
 

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

Back
Top