Test for duplicate value

McF
03-11-2003, 04:51 PM
I need to halt an entry with a duplicate value.
Combo box = 0 (dropdown combo for user entry)

Dim intIndex As Integer
'loop through the list

For intIndex = 0 To cboCoffee.ListCount - 1

If cboCoffee.Text = cboCoffee.List(intIndex) Then
MsgBox "Already have a matching entry"
End If

Next intIndex


Thanks

Iceplug
03-11-2003, 04:53 PM
Looks good... perhaps you should put this in the ComboBox validate event and set Cancel = True after you call the MsgBox. :)

McF
03-11-2003, 04:57 PM
Appreciate it!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum