lifeson
09-14-2007, 11:57 AM
Friday night and still working :banghead:
I have a list box (lstAcc) which is set up as a multiselect option and I want to display a userform (frmAccQty) for each item selected in the listbox.
Its a list of accessories available for a component and the user selects the accessories they require from the list box and then a user form is diplayed asking how many of each item they want.
I have this so far: :think:
Private Sub cmdSelect_Click()
Dim iItem As Long
lstAcc.BoundColumn = 2
If lstAcc.ListIndex = -1 Then
msg = "No item has been selected," & vbNewLine
msg = msg & "Select an item from the list to add"
ans = MsgBox(msg, vbExclamation)
Else
For iItem = 0 To lstAcc.ListCount - 1
If lstAcc.Selected(iItem) = True Then
FrmAccQty.Show
lstAcc.Selected(iItem) = False
End If
Next
End If
End Sub
The user form code is
Private Sub UserForm_Initialize()
Dim desc As String
desc = FrmBlrDetail.lstAcc.Value
txtDesc = desc
txtQty.SetFocus
End Sub
I have a list box (lstAcc) which is set up as a multiselect option and I want to display a userform (frmAccQty) for each item selected in the listbox.
Its a list of accessories available for a component and the user selects the accessories they require from the list box and then a user form is diplayed asking how many of each item they want.
I have this so far: :think:
Private Sub cmdSelect_Click()
Dim iItem As Long
lstAcc.BoundColumn = 2
If lstAcc.ListIndex = -1 Then
msg = "No item has been selected," & vbNewLine
msg = msg & "Select an item from the list to add"
ans = MsgBox(msg, vbExclamation)
Else
For iItem = 0 To lstAcc.ListCount - 1
If lstAcc.Selected(iItem) = True Then
FrmAccQty.Show
lstAcc.Selected(iItem) = False
End If
Next
End If
End Sub
The user form code is
Private Sub UserForm_Initialize()
Dim desc As String
desc = FrmBlrDetail.lstAcc.Value
txtDesc = desc
txtQty.SetFocus
End Sub