Solved

Need Column(1) in  ItemData(varItm)

Posted on 2001-06-27
7
833 Views
Last Modified: 2012-08-14
Hello Experts,
Can anyone help me get the second column from a 2 column List Box?

I can get the Bound column like this...

For Each varItm In Me!MyList.ItemsSelected
          strSQL = strSQL & Me!lstCustomers.ItemData(varItm)
          strSQL = strSQL & "','"
          intCount = intCount + 1
Next varItm

But how do I work Column(1) into that?

In otherwords, I would like to get the second column (the unbound column) of the 2 column list.

I tried...
Me!lstCustomers.ItemData(varItm).Column(1)
("Object Required")

and...
Me!lstCustomers.Column(1).ItemData(varItm)
("Object Required")

and...
Me!lstCustomers.ItemData(varItm, 1)
("Wrong Number of Arguments")

and...
Me!lstStateAreaCode.Column(1)
(returns "")

Any ideas?

Thanks,
Mac
0
Comment
Question by:MacRena
  • 4
  • 3
7 Comments
 
LVL 54

Expert Comment

by:nico5038
Comment Utility
Did you try: varItm.column(1) ?

Nic;o)
0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
Hi Nico,

I'm not sure what you are suggesting...

I already tried...
Me!lstCustomers.ItemData(varItm).Column(1)
("Object Required")

do you mean? ...
Me!lstStateAreaCode.varItm.Column(1)
("Object doesn't support this property or method"

Can you please add a little more of the line so I can tell what your syntax would be?

Thanks,
Mac

0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
Oops, I'm getting 2 rountines mixed up...

Don't worry that there seems to be a problem with the name of the list box.  There is one called lstCustomers, and one called lstStateAreaCode.  They both are trying to do the same thing.

Mac

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 54

Expert Comment

by:nico5038
Comment Utility
I'm referring to varItm as a listboxitem "on itself".
The [for each] should offer the Item "itself" with the columns as property.
Got the idea?

Nic;o)
0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
Hmmm,  I'm sorry, Nico.  I'm not sure I follow you...

This is what exposes the VALUE of the Bound Column, or Column(0), in a loop through the selected List Items

Me!lstStateAreaCode.ItemData(varItm)

Now, you suggest that varItm is a "ListBoxItem" unto itself.
You also suggest that varItm exposes it's Columns property, and that I should be able to return the values of those Colunms.

Help says "The ItemData property returns the data in the bound column for the specified row"  That would be varItm, wouldn't it?  I mean, varItm would be the DATA in the Bound Column(0) that was returned by .ItemData().
I'm not understanding how you suggest that I would expose the DATA in the Column(1) from that.

Would you please write me a statement illustrating what your syntax might look like?

Thank you very much.
Mac


0
 
LVL 54

Accepted Solution

by:
nico5038 earned 50 total points
Comment Utility
Hi,

This will work:

For Each varItm In Me!MyList.ItemsSelected
         strSQL = strSQL & Me!lstCustomers.Column(1, varItm)
         strSQL = strSQL & "','"
         intCount = intCount + 1
Next varItm

(Was too much on the "Object" focussed, without testing....)

Nic;o)
0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
Hello Nico,
Yes, that was perfect.  Thanks so much - Again!
Mac
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now