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. But, this other syntax works:
6. i can clearly see items selected in the listbox.
7. If i try to close the form, it will not close!
DoCmd.Close acForm, "Flex2 Hospitals"
8. but, after trying to close the form, THEN i can get the ItemsSelected
What's the problem?
The SECOND time i try to close the form, it closes properly:
DoCmd.Close acForm, "Flex2 Hospitals"
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.
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:
postimg.org/image/ft8enykt9
postimg.org/image/6wxmk0u71
also posted to:
accessforums.net, utteraccess.com, access-programmers.co.uk
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?
Code:
?[Form_Flex2 Hospitals].lstHospitals.ItemsSelected.Count
' returns 0, even if items are selected
Code:
?Forms![Flex2 Hospitals].Form.[lstHospitals].ItemsSelected.Count
' returns correct number of selected items
7. If i try to close the form, it will not close!
DoCmd.Close acForm, "Flex2 Hospitals"
8. but, after trying to close the form, THEN i can get the ItemsSelected
Code:
?[Form_Flex2 Hospitals].lstHospitals.ItemsSelected.Count
' returns correct number of selected items ONLY if i try to close the form first
What's the problem?
The SECOND time i try to close the form, it closes properly:
DoCmd.Close acForm, "Flex2 Hospitals"
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.
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:
postimg.org/image/ft8enykt9
postimg.org/image/6wxmk0u71
also posted to:
accessforums.net, utteraccess.com, access-programmers.co.uk
Last edited: