|
-
Nov 7th, 2002, 04:37 AM
#1
Thread Starter
Frenzied Member
** 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:
Do While Not rs1.EOF
tempSupplier = rs1.Fields(0)
tempSupplierName = RTrim(rs1.Fields(1))
Suppliers.Add tempSupplier, tempSupplierName
rs1.MoveNext
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.
-
Nov 7th, 2002, 04:41 AM
#2
Thread Starter
Frenzied Member
DOH !
Just realised the SECOND parameter is the key
I need coffee !!!
-
Nov 7th, 2002, 04:43 AM
#3
Frenzied Member
Good idea, i'll get one to (coffee)
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|