Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8420727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:56:21+00:00 2026-06-10T02:56:21+00:00

I am not certain why this is, but in the Click event, I need

  • 0

I am not certain why this is, but in the Click event, I need to get at the selected item in my Listbox, but when the loop is initialized, there are no selecteditems available.

 Private Sub lstUPSCs_Click()
        On Error GoTo Err_lstAttribute_Change

                    Dim strSelect  As String
                    Dim sQuery As String
                    Dim sUPSC As String 
                    Dim itm As Variant


                    For Each itm In Me.lstUPSCs.ItemsSelected
                      strSelect = strSelect & "," & LTrim(RTrim(Mid(lstUPSCs.Column(0, itm), 1, 8)))

                    Next

END SUB

Any help with fixing this problem please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:56:22+00:00Added an answer on June 10, 2026 at 2:56 am

    For a multiselect list box, the following code should return a list of values in the first column (column 0). I would not generally use a click event for a multiselect listbox.

    For Each itm In Me.lstUNSPSCs.ItemsSelected
      strSelect = strSelect & "," & Me.lstUNSPSCs.Column(0, itm)
    Next
    
    strSelect = Mid(strSelect,2)
    

    For a listbox without multiselect, the default value of the listbox is the value of the bound column. The above code will not work, but you can simply say:

    Me.lstUNSPSCs
    

    Or

    Me.lstUNSPSCs.Column(2)
    

    Where the number is any valid column number starting from zero.

    As an aside, there is no need to LTrim, RTrim – Trim covers both.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this sort of code is not best practice, but nevertheless in certain
I am not certain about this and searching a bit hasn't turned up anything
I'm not certain how to explain this with the correct terms so maybe an
I apologize if this has already been asked - I'm not certain of the
I need to define a Wix file component that may not exist in certain
I have a panel in extjs-3.x. On a certain event(say click of a button),
I usually implement click event bound to a certain visual element, like final Button
Im stuck I got this flash that need's to be configured in a certain
I have a script that is looking for a live click event, but I
I have a project where there are 64 buttons, you have to click certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.