Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

listbox not populating all fields

vba 2010 excel

I'am populating a listbox via an array:
Arr = objMyRecordset.GetRows
       objMyRecordset.MoveFirst

With UserForm2.ListBox1
.Clear
.Column = Arr
.ColumnCount = 36
'.RowSource = Arr
        .ListIndex = -1
End With


I'AM not getting all the columns to show in the listbox?

so i tried setting the rowsource to "Arr"

But keep getting errors .?


Thanksd
fordraiders
0
Fordraiders
Asked:
Fordraiders
  • 5
  • 4
1 Solution
 
NorieData ProcessorCommented:
Try using List and transposing the array.
With UserForm2.ListBox1
    .ColumnCount = objMyRecordset.Fields.Count
    .List = Application.Transpose(Arr)
End With

Open in new window

0
 
FordraidersAuthor Commented:
.List = Application.Transpose(Arr)    error on this line <-----------
0
 
NorieData ProcessorCommented:
Any particular error?

Does your recordset have any null fields?

How many records are in it?
0
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.

 
FordraidersAuthor Commented:
error 13 typemismatch..
Does your recordset have any null fields?

"yes"

it varys...after each executing  request
0
 
FordraidersAuthor Commented:
I'am using a temp variable to see if the arr is getting this value .
Dim strb As String

strb = objMyRecordset.Fields(15)
strb = strb

and it clearly is...
but once the array is populated it does not show in the listbox ?
0
 
NorieData ProcessorCommented:
I think the problem might be the nulls.

Try rewriting your query so that they are replaced with blanks, or whatever is appropriate.
0
 
FordraidersAuthor Commented:
weird because i have other places in the data where the fields are null?
0
 
NorieData ProcessorCommented:
Do you mean other places where you are populating listboxes with arrays that have null values?
0
 
FordraidersAuthor Commented:
Thanks, got me on the right track !
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now