Concatenating Arrays

Results 1 to 3 of 3

Thread: Concatenating Arrays

  1. #1
    Mike H. Guest

    Default Concatenating Arrays

    How can I take the contents of an array and stick it at the end of another array? If arFirst has 15 items in it and arSecond has 10 items in it, how can I attach arSecond to the end of arFirst so that arFirst(15) would be the same thing as arSecond(0) (with, of course, redim preserve arFirst (24))? It gets a little more complex, arFirst is obtained by doing GetRows() from a recordset. Then arSecond is by doing GetRows() from a recordset with the same fields, but with a different WHERE clause. Hope someone can help, Thanks.<BR>Mike

  2. #2
    Steve Cimino Guest

    Default RE: Concatenating Arrays

    Original = UBound(arFirst)<BR>ReDim Preserve arFirst(Original + UBound(arSecond))<BR><BR>j = 0<BR> For i = Original To UBound(arFirst)<BR> arFirst(i) = arSecond(j)<BR> j = j + 1<BR> Next<BR><BR><BR>Obviously, you&#039;ll have to tweak this for a two dimenisonal array, but I don&#039;t have the time to play with it. You also may want to check that the first element is UBound, not UBound + 1... like I said, this should get you started at the very least.

  3. #3
    Mike H. Guest

    Default Thanks, Steve

    Thanks, Steve, for your quick response. I think that will do the trick. As usual, your quick answer will probably save me a great deal of time.<BR><BR>Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts