Populating a list box from a recordset

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:50 PM GMT

Question

This code is not giving the expected result:

  Dim vRecords As Variant
  Dim rs As ADODB.Recordset
  'establish rs connection code here
  vRecords = rs.GetRows
  ListBox1.List = vRecords 

The recordset being read contains: 3,Eur,Euros 2,GBP,British Pounds 1,USD,US Dollars

The list box resulting from the above code is: 1 USD US Dollars

It looks as though the array needs to be transposed but this code gives me a data mismatch error:

For intLoopCounter = LBound(varTempArray, 2) To UBound(varTempArray, 2)

   For intLoopCounter2 = LBound(varTempArray, 1) To 

UBound(varTempArray, 1)

       varTempArray2(intLoopCounter, intLoopCounter2) = 

varTempArray(intLoopCounter2, intLoopCounter)

   Next intLoopCounter2

Next intLoopCounter



Answer

Richard

I am definately not a VBA expert--so I will not be able to help you. I suggest you reask the question of another allexperts person and check the resumes for someone who is a VBA expert. I'm sure you can get a good answer.

Sorry I couldn't be of more help.

Advertisement

©2024 eLuminary LLC. All rights reserved.