Cbo Box comparision

mark curtis

Registered User.
Local time
Today, 10:45
Joined
Oct 9, 2000
Messages
457
Dear all,

I have three combo boxs which store values 1 to 4 in each. Is there a niffy way to check if a user has entered selected the same value for two or more of the combo boxes?

Thanks
Mark
 
Mark,

Dunno if this is the best way, but here goes:

Private Sub Combo1_BeforeUpdate(Cancel As Integer)
If Me.Combo1.Column(1) = Combo2.Column(1) Or Me.Combo1.Column(1) = Combo3.Column(1) Then
MsgBox "same"
Cancel = True
End If
End Sub

I think you'll have to reference the column like this, else it will compare the values of the primary key. If you did it like above you would have to do it in the other two before update events though (just altering the comparison slightly). So, it's probably best to write a function to check all possibilities at once and call it from each event.
 

Users who are viewing this thread

Back
Top Bottom