Results 1 to 2 of 2

Thread: 2 dimensional collections?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Reading, UK
    Posts
    1

    Question

    I am trying to write a collection where I can store a product id and a quantity together. However both the product id and quantity may appear more than once in the collection and so neither can be set as the key. Is there another kind of collection I could use which will relate the two peices of information to each other and allow me to access it by querying on the product id?

    regards,
    Ayla

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    You can use array of User Defined Type:

    Code:
    Option Explicit
    
    Private Type udtProductOrder
        lngProductID As Long
        intQuatity As Integer
    End Type
    
    Private tProductOrders() 'array of product orders
    When you populate tProductOrders array with your data, the Index of each array element would be a unique criteria to identify each product, i.e

    MsgBox tProductOrders(0).lngProductId & vbTab & tProductOrders(0).intQuantity


    Regards,


    Regards,

Posting Permissions

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



Click Here to Expand Forum to Full Width