G
Guest
Hello
I am reviewing a book to learn some more vba for access and came accross the following code to get the list of selected item from a multi select list box
****
Private Sub lstCompanies_AfterUpdate(
' Print the list of selected items to the tex
' box txtSelected
Dim varItem As Varian
Dim strList As Strin
#If False The
' Here's the slow way to list the selected companies
' This code won't execute, since it's commente
' out the the #If False Then...#End I
Dim intI As Intege
With Me!lstCompanie
For intI = 0 To .ListCount -
If .Selected(intI) The
strList = strList & .Column(0, varItem) & vbCrL
End I
Next int
End Wit
#End I
' Here's the better way to do it
With Me!lstCompanie
If .MultiSelect = 0 The
Me!txtSelected = .Valu
Els
For Each varItem In .ItemsSelecte
strList = strList & .Column(0, varItem) & vbCrL
Next varIte
Me!txtSelected = strLis
End I
End Wit
End Su
****
why/what does the "#" do in the authors coding?
thank
Daniel
I am reviewing a book to learn some more vba for access and came accross the following code to get the list of selected item from a multi select list box
****
Private Sub lstCompanies_AfterUpdate(
' Print the list of selected items to the tex
' box txtSelected
Dim varItem As Varian
Dim strList As Strin
#If False The
' Here's the slow way to list the selected companies
' This code won't execute, since it's commente
' out the the #If False Then...#End I
Dim intI As Intege
With Me!lstCompanie
For intI = 0 To .ListCount -
If .Selected(intI) The
strList = strList & .Column(0, varItem) & vbCrL
End I
Next int
End Wit
#End I
' Here's the better way to do it
With Me!lstCompanie
If .MultiSelect = 0 The
Me!txtSelected = .Valu
Els
For Each varItem In .ItemsSelecte
strList = strList & .Column(0, varItem) & vbCrL
Next varIte
Me!txtSelected = strLis
End I
End Wit
End Su
****
why/what does the "#" do in the authors coding?
thank
Daniel