Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot find list property

Status
Not open for further replies.

jjmclell

Technical User
Aug 10, 2007
34
CA
Hi there,

I'm trying to use the list property of a listbox in Access and VBA won't recognize the property.

Code:
temp = Me!lst_Items.List(0, 0)

I get this error when trying to execute the above code:

'Object doesn't support this property or method.'

Any ideas?

jjmclell
 
That is because a list box doesn't have a list property (makse sense?). Try ListIndex property.

Cogito eggo sum – I think, therefore I am a waffle.
 
Oops. Maybe ItemData property, depending on what you're after...

Cogito eggo sum – I think, therefore I am a waffle.
 
I think I know what you're saying genomon. When I type "listbox1.", the list of methods and properties for autocomplete definitely doesn't include the "list" property. However, the MS Forms 2.0 object library, which I have checked off in my references, describes the List Property of the listbox or combobox control. I have also found some code that uses the list property for exactly what I'm trying to do, but for whatever reason, my VBA isn't picking it up.

jjmclell
 
Ok, I just had a bit of a revelation. My problem is that my control is an MS Access control, not an MS Forms control. I had assumed that if I had a control in a form, it must be an MS Forms 2.0 object, which (in the case of a listbox) has the list property. But it's a native MS Access control, therefore no list property.

Thanks for the help!

jjmclell
 
God Bless Bill Gates and his infinite wisdom.

[nosmiley]

Cogito eggo sum – I think, therefore I am a waffle.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top