By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,705 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,705 IT Pros & Developers. It's quick & easy.

Reference a 2nd Column in Listbox in Code

P: n/a
Access 2003 Frt end, SQL 2000 Back end

My listbox has 2 columns "UserID" & "FullName" (UserID is a Primary

I am trying to loop thru the multi-select listbox to print a separate
report for each user selected.

However, I need for the UserID and Fullname from the listbox to print
on the report. Ihave tried a couple of different options below without
success. I can't seem to grab the FullName from the 2nd column. I may
be going about this all wrong.

The msgbox line is for testing w/o printing.

As Always, Any Help Appreciated!
Dim stDocName As String
Dim Myname As Variant
Dim User1, User2 As String
For Each Myname In Me!List6.ItemsSelected

User1 = Me.List6.ItemData(Myname)
'User2 = Me.List6.Column(1).ItemData(Myname)
'User2 = DLookup("[UserID]", "tblReg", "[UserID] =" & User1)

MsgBox (User1 & vbCrLf & vbCrLf & User2)

'stDocName = "rptScanSt_Multi"
'DoCmd.OpenReport stDocName, acViewPreview

Next Myname

Dec 12 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Apparently to get to data in a listbox you need BOTH index and row.
Here is code from a form that is executed on the dblclick event and
then it does a compare for days greater than 30 for the row

if me.CNDAPPBx.Column(9, me.CNDAPPBx.ListIndex + 1) 30 then
Try playing with that.


Dec 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.