PDA

View Full Version : ActiveX Textbox Help



Emoncada
06-11-2013, 02:24 PM
I have a form on a spreadsheet. I have a textbox that the user needs to be able to scan into. I need for the user to be able to scan a barcode into it and then have vb determine if Len(TxtUPC).object.value = 14 or 12, if so Call NextScript

So I have something like this

Private Sub TxtUPC_Change()
If Len(TxtUPC.Value) = 14 Or _
Len(TxtUPC.Value) = 12 Then

If TxtBox.Value <> "" Then
Call VbLookUp
Else

MsgBox ("Please Enter a Box #")
TxtBox.Activate
End If
End If


The problem is when the user scans a barcode 14 characters long it takes it as the first 12. How can I have it wait and see if it's 14 long?

I don't have a "_Before Update" just _change since it's the spreadsheet.

Any Ideas?

Doug Robbins
06-12-2013, 09:45 PM
How about using the LostFocus event?