Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

showing multiple colums in list box

Posted on 2014-01-03
3
Medium Priority
?
225 Views
Last Modified: 2014-01-11
Folks

How do I display multiple columns in a listbox, my below code works but would be well suited with another column to display


strSQL = "SELECT * FROM TABLEA WHERE S_TYPE  ='OUTDOOR'"
   
    MsgBox (strSQL)
   
    Set oRsOracle = oConOracle.Execute(strSQL)
 
  Do Until oRsOracle.EOF
    ListBox1.AddItem oRsOracle.Fields(3).Value
        oRsOracle.MoveNext
  Loop
 
  oRsOracle.Close


all help will do
0
Comment
Question by:rutgermons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Expert Comment

by:ChloesDad
ID: 39755075
You can build a string that is something like

ListBoxText = oRsOracle.Fields(3).Value & " - " & oRsOracle.Fields(4).Value

Then add that to the list box

ListBox1.AddItem ListBoxText

You can then have a play with adding CHR(9) (tab) to try and tabulate the text
0
 

Author Comment

by:rutgermons
ID: 39755259
the concept seems ok but I am using a loop like so

 Do Until oRsOracle.EOF
    ListBox1.AddItem oRsOracle.Fields(4).Value
     oRsOracle.MoveNext
  Loop

seems when I use your suggestion it only shows the values from the first record in the list but repeated continuously

i.e.

car-ford
car-ford
car-ford
car-ford

any ideas?
0
 
LVL 15

Accepted Solution

by:
ChloesDad earned 2000 total points
ID: 39755283
Where did you put the code that I posted, it should replace this line in your code

   ListBox1.AddItem oRsOracle.Fields(4).Value

so you get

 Do Until oRsOracle.EOF
    ListBoxText = oRsOracle.Fields(3).Value & " - " & oRsOracle.Fields(4).Value
    ListBox1.AddItem ListBoxText

    oRsOracle.MoveNext
  Loop
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question