Results 1 to 8 of 8

VBA Bar Coding Question

Threaded View

  1. #1
    Registered User
    Join Date
    10-25-2018
    Location
    USA
    MS-Off Ver
    7
    Posts
    8

    VBA Bar Coding Question

    Hello everyone - I'm using a bar code scanner to read data. When I pull the trigger on the scanner, the information is read/transferred into a text box on a form. Ideally I would like the data to go into the textbox and automatically load another form once the data is read. The original routine I had utilized a textbox_change() routine, but that didn't seem to work - as soon as the first character was read an error was generated (the data I'm inputting is a string of numbers - example 123456-00, but when pressing the trigger only the 1 would come through, then error is generated). I tried putting a pause in there so that the whole string could be read, but then nothing would happen. So then I changed to a textbox_afterupdate() routine. This initially works, but for some reason it only works 1 time, then I'm forced to close that form in order to have my routine continue.

    The code I was using with the textbox_change() routine is below:

    Private Sub txtJobNumber_Change()
         Call OpenWorkbook
    End Sub
    The OpenWorkbook routine will close the current form, then open another form - I know this code works the way I want it to if I enter the number string manually then hit enter. But it doesn't work in conjunction with the bar code scanner.

    The code I'm currently using with the textbox_afterupdate() routine is below:

    Private Sub txtJobNumber_AfterUpdate()
       If txtJobNumber.Text <> "" Then
            Call cmdScanJobEnter_Enter
        End If
    End Sub

    I've added a command button to the form which when pressed calls the OpenWorkbook routine. As I said, this code works as desired, however it will only work once, then I'm forced to close the form after the number string is read from the barcode scanner in order to have my process continue.

    Does anyone have any experience using bar code scanners with VBA, or has anyone had similar issues? How have you been able to overcome this? Any suggestions would be appreciated.

    Thanks in advance!
    Last edited by jer10671; 01-11-2019 at 08:32 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Coding Question
    By bbaynard in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2015, 08:51 PM
  2. Coding Question
    By JayT61 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2012, 03:57 AM
  3. VBA coding question
    By Zimmerman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-02-2010, 12:48 PM
  4. VBA coding question
    By mcinnes01 in forum Access Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2010, 01:04 PM
  5. Subtotal in VBA, coding question
    By D3Pratt in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-03-2009, 02:54 PM
  6. Question about merging, coding and the like
    By MichelleFinn in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 03-06-2008, 06:49 PM
  7. Coding question
    By bach in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2005, 03:59 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1