If u mean how to get the value from a listbox... You need to loop though the list box to see how many items were selected, if multi-select is enabled.
For intICnt = 0 To Me.lst_B_UNITS.ListCount - 1 'This loops from first entry in the list
If Me.lst_B_UNITS.Selected(intICnt) Then
lcB_Unit = Me.lst_B_UNITS.Column(0, intICnt)
...
Next intICnt
If not using Multi-Select, then u should be able to say,
Me.lst_B_UNITS.Value. U can use Me.lst_B_UNITS.ListIndex to locate which item you are positioned on in the list. remember u start at zero, for the first item though.
htwh,
Steve Medvid
"IT Consultant & Web Master"
Below is an eg where all values selected are sent to text boxes, and then finally grouped together. Will only work when multi select is set to simple.
Hope it helps.
Private Sub CBNEW1_AfterUpdate()
'can not have more than 4 selected net id's
If Me!CBNEW1.ItemsSelected.Count >= 5 Then
MsgBox "The maximum Number of Network Id's that can be selected is 4.", vbInformation, "INFORMATION MANAGEMENT"
Exit Sub
End If
'reset hidden text boxes to null
Me![NETID1] = Null
Me![NETID2] = Null
Me![NETID3] = Null
Me![NETID4] = Null
'update hidden text boxes with selected values
'then update net id text box with these values from hidden
'text boxes
Dim strControlName As String
Dim intControlNumber As Integer
Dim frm As Form, ctl As Control
Dim varItm As Variant, intI As Integer
intControlNumber = 1
Set frm = Forms!frm_nonroutineoperations
Set ctl = frm!CBNEW1
For Each varItm In ctl.ItemsSelected
For intI = 0 To ctl.ColumnCount - 1
strControlName = "NETID" & Format(intControlNumber)
Me.Controls(strControlName) = ctl.ItemData(varItm)
intControlNumber = intControlNumber + 1
Next intI
Next varItm
[NETWORK_ID] = [NETID1] & " " & [NETID2] & " " & [NETID3] & " " & [NETID4]
'see on current for code that deselects the list as you scroll through
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.