nomar2
asked on
Cycling through a Multi Select ListBox with many selected items VBA ACCESS
This is the problem I am having... I have a form which has a MULTI-SELECT ( Simple ) listbox and a textbox.
Right now I have this on the 'Click' event. Not sure if this is correct event.
Basically I want to be able to highlight an invoice number or many invoice numbers from the listbox and have the total that is associated with those invoice numbers be placed in the textbox.
The problem I am having is the only the total for the first selected invoice number is being read and nothing after.
How do I cycle through a listbox so that all the selected items are read?? And after all the selected invoice numbers are read I want the grand total of those invoices to be placed in the textbox.
I think have to read the first selected index and then exit out of the loop and then read the next selected index..but I am a bit fuzzy about how to do it.
I have code that reads the selected item ..
For intIndex = lstbx_status.ListCount - 1 To 0 Step -1
If lstbx_status.Selected(intI ndex) Then
lnInvoiceNumber = lstbx_status.Column(0, intIndex)
End If
Next
but it doesn't only reads the first highlighted item from the listbox.
Any help or insight would be much appreciated.
Right now I have this on the 'Click' event. Not sure if this is correct event.
Basically I want to be able to highlight an invoice number or many invoice numbers from the listbox and have the total that is associated with those invoice numbers be placed in the textbox.
The problem I am having is the only the total for the first selected invoice number is being read and nothing after.
How do I cycle through a listbox so that all the selected items are read?? And after all the selected invoice numbers are read I want the grand total of those invoices to be placed in the textbox.
I think have to read the first selected index and then exit out of the loop and then read the next selected index..but I am a bit fuzzy about how to do it.
I have code that reads the selected item ..
For intIndex = lstbx_status.ListCount - 1 To 0 Step -1
If lstbx_status.Selected(intI
lnInvoiceNumber = lstbx_status.Column(0, intIndex)
End If
Next
but it doesn't only reads the first highlighted item from the listbox.
Any help or insight would be much appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad I could help.
Rick
Rick
ASKER