Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multi selection in listbox

Status
Not open for further replies.

kimhoong79

Technical User
Jun 10, 2002
58
MY
I'm developing a small system on voucher inventory. During the voucher printing process, I plan to use listbox to display all the voucher (or voucher that have filtered out) on the left side and the make selection to the right side (also a listbox) and deselection can be made as well. The problem I am facing is that I can't multiple selection on listbox. For example, when I need to select 10 printing, I have to click 10 times. I intend to make multi selection by using the shift and click method or any other better method. Thank you!
 
Hi, this routine will print all the reports selected in a simple or extended multiselect listbox called MyList, paste the following into the On Click event of a button on the form to test it:

On Error Resume Next
Dim ctlSource As Control
Dim lngCurrentRow As Long
Dim strReport As String
Set ctlSource = Me!MyList
For lngCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(lngCurrentRow) Then
strReport = ctlSource.Column(0, lngCurrentRow)
DoCmd.OpenReport strReport
End If
Next lngCurrentRow

 
Hi,
u can use the multi select property either simple or Extended in extended u can use the shift key and mouse or shift key and arrow key
 
my form will be something like this

DATA TO PRINT
--------- -----------
| | | |
| | > | |
| | | |
| | >> | |
| | | |
| | | |
| | < | |
| | | |
| | << | |
| | | |
--------- -----------

PRINT EXIT


I can multiselect in the DATA listbox but when I click the arrow button, only the first one will be selected n moved into the TO PRINT listbox. Please help on that!!!
 
kimhoong:

Does your 'TO PRINT' box have any other function than listing the vouchers to print?

If it does not, then I think you don't need it. You can directly print the vouchers which are selected in the 'DATA' box.

Then in the OnClick event of your PRINT button, put code similar to:

Dim ctlList As Control, varItem As Variant


' Return Control object variable pointing to list box.

Set ctlList = Me.name of list box

' Enumerate through selected items.

For Each varItem In ctlList.ItemsSelected

Put your code here for printing

Next varItem


HTH,

Vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top