danielmarkus
asked on
Can't set listindex property of a combo box
Hi Experts,
I must be overlooking something.
me.combox.listindex = SomeInterger
Above statement generates error "7777"
Did this property suddenly became "read only"?
What is the proper method to set a combo box.
Any help will be highly appreciated.
I use Access 2002.
Daniel
I must be overlooking something.
me.combox.listindex = SomeInterger
Above statement generates error "7777"
Did this property suddenly became "read only"?
What is the proper method to set a combo box.
Any help will be highly appreciated.
I use Access 2002.
Daniel
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
One other cause of this error is trying to set the ListIndex to an invalid value (eg setting it to 100 when the list only contains 50 items).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No it isn't :-)
I should qualify that - it isn't in A2K2 (and presumably in A2K), but is in A97.
I think the confusion arises with what is meant by read/write for the Listindex property in Help.
You cannot change an entry's listindex value which I think is what is meant in Help when it describes the property as read-only. But you certainly can set the combo box listindex value to select an item. I think you could probably argue for ever over whether this constitutes 'write'.
Help for Listindex has changed from A97 where it described the property as read/write in one entry and read-only in another to A2003 where it is said to be read-only but also includes an example of setting the value!
Anyway you can set the value.
Pete
You cannot change an entry's listindex value which I think is what is meant in Help when it describes the property as read-only. But you certainly can set the combo box listindex value to select an item. I think you could probably argue for ever over whether this constitutes 'write'.
Help for Listindex has changed from A97 where it described the property as read/write in one entry and read-only in another to A2003 where it is said to be read-only but also includes an example of setting the value!
Anyway you can set the value.
Pete
Just checked again, it does not work in Access 2000 (can't try 2003 here).
Cheers:)
Cheers:)
Must be specific to A2K2 onwards - I skipped A2K completely :)
Well, ok, I resign :) The question did specify the version number...
(I just hope the .ItemData() wordaround still works in A2K+ !!!)
;)
(I just hope the .ItemData() wordaround still works in A2K+ !!!)
;)
As far as i can see the code I gave in my first response works in every version of Access from (and including) A97 onwards. The setfocus command is always required.
Pete
Pete
This is not fair, I already resigned :(
I just tested your code, Pete, and of course it works. Now I must say: "I learned something"... here it goes:
Hey, I learned something! I never knew that!
(Thanke, Pete, I really didn't! And it does explain the strange error message, in a way...)
Cheers ;)
I just tested your code, Pete, and of course it works. Now I must say: "I learned something"... here it goes:
Hey, I learned something! I never knew that!
(Thanke, Pete, I really didn't! And it does explain the strange error message, in a way...)
Cheers ;)
All this for 50 points!
And the original poster hasn't made an appearance!
Hope it works for him!
Pete
And the original poster hasn't made an appearance!
Hope it works for him!
Pete
ASKER
Sorry not to react immediately. Different timezone. Since both solutions worked in Access 2002 I rewarded both contributors.
BTW Great discussion. You should award me some points for initiating :)
Kind regards,
Daniel
BTW Great discussion. You should award me some points for initiating :)
Kind regards,
Daniel