Results 1 to 5 of 5
  1. #1
    johnywhy is offline Novice
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Posts
    11

    Cannot Get ListBox .ItemsSelected, help!

    Help.

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


    1. the form is visible, and i manually select some items in the listbox.
    2. then in vba i get the .ItemsSelected.Count property of the listbox.
    3. ItemsSelected.Count is 0. This is a bug?
    4. i can see items selected in the listbox.




    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.

    also posted to http://www.utteraccess.com/forum/Lis...-t2008662.html

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Post the exact code you are using or provide db for analysis. The code is located where?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    johnywhy is offline Novice
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Posts
    11

    never mind

    Quote Originally Posted by June7 View Post
    Post the exact code you are using or provide db for analysis. The code is located where?
    never mind, i found my answer elsewhere.
    ps, how come i cannot see my OP?

    thx

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Quote Originally Posted by johnywhy View Post
    never mind, i found my answer elsewhere.
    ps, how come i cannot see my OP?

    thx
    You should see it now. I thought I approved it earlier but must have goofed up. It may help others if you post your solution here.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    johnywhy is offline Novice
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Posts
    11
    SOLVED:


    thorough explanation here:


    social.msdn.microsoft.com/Forums/office/en-US/cb59d18f-3214-4fe5-bdc8-bf40c99fb483/cannot-get-listbox-itemsselected-help?prof=required


    "If the form isn't loaded when you make this reference to its class module, Access will load a hidden copy of the form and add it to the Forms collection."


    "remove all uses of Form_<form name> and replace them with the canonical usage:


    'DoCmd.OpenForm "FormName"' instead of 'Form_FormName.Visible = True'
    'Forms!FormName.ControlName' or 'Forms("FormName").ControlName' instead of Form_FormName.ControlName
    'DoCmd.SelectObject "FormName"' instead of Form_FormName.SetFocus

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 06-24-2013, 07:34 AM
  2. Replies: 10
    Last Post: 06-18-2013, 02:00 PM
  3. Replies: 3
    Last Post: 12-13-2012, 04:40 AM
  4. Replies: 1
    Last Post: 09-10-2012, 11:21 PM
  5. Replies: 1
    Last Post: 07-26-2012, 11:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums