loop thro a access list box

C

Chris Murray

How can I loop thro a list box and add each entry to a var. I have been
trying now for what seems like hours and I just cant crack it.


visual basic
code:------------------------------------------------------------------------------

For n = 1 To Order!Basket.ListCount

Shopping = Shopping & Order!Basket.List(n - 1)
Next n

------------------------------------------------------------------------------

the above code works fine in Excel but in access the list box seems to be
missing the .list attribute.

please any words of advise

thanks Chris
 
M

Marshall Barton

Chris said:
How can I loop thro a list box and add each entry to a var. I have been
trying now for what seems like hours and I just cant crack it.


visual basic
code:------------------------------------------------------------------------------

For n = 1 To Order!Basket.ListCount

Shopping = Shopping & Order!Basket.List(n - 1)
Next n


For List and Combo boxes, you need to use the ItemData
property to retrieve the bound column's value.

There's also the Columns property that allows you to get to
any row/column in their row source.
 

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