X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Retrieving Selected Data From Listbox To Form, Access 2016    
post Feb 28 2018, 03:40 AM

Posts: 17
Joined: 8-February 18

Hi all, I am having an issue where I am able, to retrieve and sum up the lbs and yds by selecting the data that I need. However it only able to retrieve one of the colour out of the lines that I selected. How can i solve it?

Attached File(s)
Attached File  Untitled.png ( 14.45K )Number of downloads: 5
Go to the top of the page
post Feb 28 2018, 04:35 AM

Posts: 992
Joined: 26-March 08
From: London, UK

Hi Step,

The code below should iterate through all of the selected rows in your listbox and simply print the colour names to the immediate window (what do you want to do with the colours?). You will need to replace 'YourListboxName' with the name of your listbox and 'ColIndex' with the relevant column index.

        Dim intIndex as Integer

        For intIndex = 1 To Me.YourListboxName.ListCount - 1 'Rows are zero-based.  Row 0 is the headings row, so start from row 1.
            If Me.YourListboxName.Selected(intIndex) Then
                Debug.Print Me.YourListboxName.Column(intIndex, ColIndex) 'ColIndex is the index no. of the column (zero-based; 1st column is index 0).
            End If


This post has been edited by HairyBob: Feb 28 2018, 05:03 AM
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    21st March 2019 - 05:26 AM