Cannot Get ListBox .ItemsSelected, help! (1 Viewer)

johnywhy

Registered User.
Local time
Today, 07:59
Joined
Aug 24, 2010
Messages
26
Help.

i am unable to retrieve .ItemsSelected of a multiselect listbox on a form.


1. the form is visible
2. i manually select some items in the listbox.
3. then in VBA i get the .ItemsSelected.Count property of the listbox.
4. ItemsSelected.Count returns 0. This is a bug?
5. i can clearly see items selected in the listbox.
6. If i try to close the form, it will not close!
DoCmd.Close acForm, "Flex2 Hospitals"
7. but, after trying to close the form, THEN i can get the ItemsSelected


What's the problem?

More info:
i am loading several forms in Hidden mode.
then i make only one form visible at a time by VBA.

if i open this one form by itself, with no other forms loaded, then i am able to retrieve .ItemsSelected.Count value correctly.

Here's the code:
?[Form_Flex2 Hospitals].lstHospitals.ItemsSelected.Count

More Weirdness

Must Close Twice:
The form will not close on first try:
DoCmd.Close acForm, "Flex2 Hospitals"

but it WILL close if i execute the same code again.


Not Current Object:
This code returns the name of a hidden form, instead of the open form:
?CurrentObjectName
' returns name of a hidden form, instead of the visible one.

If i attempt to setfocus to this form, CurrentObjectName STILL returns name of a hidden form.
[Form_Flex2 Hospitals].SetFocus
?CurrentObjectName
' returns name of a hidden form, instead of the visible one.

Here are images of the form:
http://postimg.org/image/ft8enykt9/
http://postimg.org/image/6wxmk0u71/


also posted to:
Cannot Get ListBox .ItemsSelected, help!
Access Help and How-to - Microsoft Office Cannot Get Listbox .itemsselected, Help! - UtterAccess Discussion Forums
Cannot Get ListBox .ItemsSelected, help! - Access World Forums
 
Last edited:

Users who are viewing this thread

Top Bottom