AlanAnderson
Board Regular
- Joined
- Jun 7, 2010
- Messages
- 134
Hi,
I have a little routine that is supposed to test that duplication does not occur. Problem is that if I use tbPPCode_Click the user may bypass it by using tab keys. If I use tbPPCode_Change the event triggers on the second key pressed. How can I force this routine to wait untill the client moves on to the next field
Thanks,
Alan
I have a little routine that is supposed to test that duplication does not occur. Problem is that if I use tbPPCode_Click the user may bypass it by using tab keys. If I use tbPPCode_Change the event triggers on the second key pressed. How can I force this routine to wait untill the client moves on to the next field
Thanks,
Alan
Code:
Private Sub tbPPCode_Change()
Dim PPCode As String
Dim FinalRowPricePoint As Long
FinalRowPricePoint = Cells(Rows.Count, 1).End(xlUp)
Sheets("PricePricePoint").Select
For i = 2 To FinalRowPricePoint
If Me.tbPPCode = Cells(i, 1) Then
MsgBox "You may not enter duplicate codes"
Me.tbPPCode = ""
End If
Next i
End Sub