Relate a Number with an ARRAY

J

J@Y

I would like to have some kind of relationship established between numbers
and Arrays. For example, if I call number 1234, I want it to return an
ArrayA(1 to 10) . Library Variables won't work because I can't have Arrays
stored in the Items slot. What can I do?
 
R

Rick Rothstein \(MVP - VB\)

I would like to have some kind of relationship established between numbers
and Arrays. For example, if I call number 1234, I want it to return an
ArrayA(1 to 10) . Library Variables won't work because I can't have Arrays
stored in the Items slot. What can I do?

Can you explain what you want to do in more detail? ArrayA(1 to 10) is
something you would find in a Dim or ReDim statement, so I am not completely
sure what you are after.

Rick
 
J

J@Y

OK heres an example:

I have Basket # 1908765
In Basket # 1908765, there are 10 items.

I store the 10 items in an array.
I want it so that when the Basket # 1908765 is called, the array is returned.

Hope that clears it up abit.
 
J

Jim Thomlinson

You can use a collection something like this...

Sub Test()
Dim aryA(1 To 2) As Integer
Dim ary() As Integer
Dim col As Collection

Set col = New Collection

aryA(1) = 123
aryA(2) = 234

col.Add aryA, "12345"

aryA(1) = 987
aryA(2) = 654

col.Add aryA, "98765"

ary = col.Item("12345")
MsgBox ary(1)
ary = col.Item("98765")
MsgBox ary(1)
End Sub
 
J

J@Y

So I assume Collection allows arrays to be stored in the "items" whereas
Dictionary doesnt?
 
T

Tushar Mehta

Why not try both and check? If nothing else you'll learn some more
about each of the data structures.

So I assume Collection allows arrays to be stored in the "items" whereas
Dictionary doesnt?
{snip}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top