Results 1 to 3 of 3

Thread: ** RESOLVED ** Duplicate Key when adding to a Collection ...

Threaded View

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    ** RESOLVED ** Duplicate Key when adding to a Collection ...

    I am building a collection of Supplier numbers and names.

    The supplier numbers are unique, but the supplier names are not necessarily !

    My code is as follows :

    VB Code:
    1. Do While Not rs1.EOF
    2.         tempSupplier = rs1.Fields(0)
    3.         tempSupplierName = RTrim(rs1.Fields(1))
    4.  
    5.         Suppliers.Add tempSupplier, tempSupplierName
    6.        
    7.         rs1.MoveNext
    8.     Loop

    I have hit a supplier who shares the same name as one that has already been added, and its throwing up a duplicate key error


    i.e.

    875 CAVALCADE CLOTHING CO LTD
    30186 CAVALCADE CLOTHING CO LTD

    I assumed that the supplier NUMBER would be the key, therefore I would not have a problem

    Does this mean ANY data added to a collection MUST be unique ?

    Confused ..........
    Last edited by TheBionicOrange; Nov 7th, 2002 at 04:42 AM.

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