Referencing a Column in a List Box

E

Eka1618

Hello,

I am not sure why I cannot reference the selected column in either of my
list boxes. The following code works well on a form... I thought I had it
working well on the report, but it is saying that the column is Null. Only
one row is selected in these list boxes when it is displayed on a report.

My code is written as if multiple items could be selected, but I'm just not
sure why it would make a difference in this case:


Dim teesEmail, torsEmail As String, varItem As Variant
Dim request As Long

DoCmd.Maximize

For Each varItem In Me.lboRequestee.ItemsSelected
teesEmail = teesEmail & Me.lboRequestee.Column(2, varItem)
Next varItem


For Each varItem In Me.lboRequestor.ItemsSelected
torsEmail = torsEmail & lboRequestor.Column(2, varItem)
Next varItem


I have looked at many examples and they all seem to match mine. If anyone
has any suggestions, please let me know, Thank you!
 
S

Stefan Hoffmann

hi,
I am not sure why I cannot reference the selected column in either of my
list boxes. The following code works well on a form... I thought I had it
working well on the report, but it is saying that the column is Null. Only
torsEmail = torsEmail & lboRequestor.Column(2, varItem)
The Row parameter must be an integer. It is the row positon. So use a
For Count = 0 To ListBox.Count - 1.


mfG
--> stefan <--
 
E

Eka1618

Hi Stefan,

it doesnt seem to be working still... this is what I have now:

Dim intCount As Integer

For intCount = 0 To Me!lboRequestee.ListCount - 1
If Me!lboRequestee.Selected(intCount) Then
teesEmail = teesEmail & Me.lboRequestee.Column(2, intCount)
End If
Next

What is strange is that if I leave the IF statement out, it will grab the
values, but I only want the one that it selected. When I use the IF
statement...it says it is NULL... It's definitely not NULL...

What do you think is going on? I am just totally stuck!

~Erica~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top