Consulting

Results 1 to 2 of 2

Thread: ActiveX Textbox Help

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    ActiveX Textbox Help

    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

    [VBA]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
    [/VBA]

    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?

  2. #2
    VBAX Contributor
    Joined
    Oct 2012
    Location
    Brisbane, Queensland, Australia
    Posts
    163
    Location
    How about using the LostFocus event?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •