print a scannable barcode Code128

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    print a scannable barcode Code128

    I keep reading that printing barcodes is no more difficult than changing fonts. I followed some advice to that effect, and I get a real pretty printed barcode, but the scanners won't read it.

    I'm trying to use Access 2007 to print a 7-digit alphanumeric order number in Code128 barcode format. Anyone have a sure-fire way to do that without spending a lot of money?

    Thanks,
    Jim
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Did you remember to output the start and stop codes?

    Comment

    • jimatqsi
      Moderator Top Contributor
      • Oct 2006
      • 1293

      #3
      Thanks for the reply, Rabbit. You're kind to suggest I know what I'm doing well enough to remember or forget anything about it. But now that you mention it, I do remember reading somewhere about having to surround the data with some codes.

      I have this Code 128 Class made by Michael Ciurescu and updated by Paulo Cunha that I found on StackOverflow. I tried to use it initially but the lure of instant gratification by just using a font distracted me from working through whatever problem I had when I tried to use it. And a lack of understanding of the purpose of it. I think now I understand better, using the Code128_Str method of that class most likely calculates the check digit and adds those start and stop codes you mentioned.

      I remember now, the problem I got when I used it was an ugly, nasty thing that was not a barcode. Using the BarCode128 font, my order number prints as a nice looking, but un-scannable barcode. Using Code128_Str(ord ernumber) in the textbox with the BarCode128 font just made a mess.

      I'm not sure how to resolve the mess.

      Jim

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You can still use the font because the 3 start codes and the stop code can be represented by ascii characters so they should be available in the font. You just need to output the correct character.

        If you scroll to the bottom of this table, the start and stop codes can be found there. https://en.wikipedia.org/wiki/Code_128#Bar_code_widths]

        Edit: One more thing, did you calculate the checksum?
        Last edited by Rabbit; Sep 12 '13, 02:13 AM.

        Comment

        • jimatqsi
          Moderator Top Contributor
          • Oct 2006
          • 1293

          #5
          No, I did not independently calculate a checksum. I was thinking that was part of what the Code128_Str method did.

          Thanks for the article, maybe that will help me figure this out.

          Jim

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Do you have a link to the code?

            Comment

            • jimatqsi
              Moderator Top Contributor
              • Oct 2006
              • 1293

              #7
              Here's the code I found on StackOverflow
              I'm trying to get Code 128 barcodes generated in Excel, through the use of VBA. I've found a VBA class that somebody made and shared via VBForums (subsequently modified to work with Excel VBA), but...

              I'll be at the office in an hour. I'll look again at my code and post any that might be helpful. But I think it is just something like
              Code:
              me.someTextbox=Code128_str(myOrderNo)
              and the font of the textbox is the BarCode128 I downloaded according to directions in that thread.

              Jim

              Comment

              • jimatqsi
                Moderator Top Contributor
                • Oct 2006
                • 1293

                #8
                Okay, I've just run another test with my pick ticket form. I'm getting something that is half bar-code, half Greek letters. The debugger gives me a value of
                ÒeyÍ8Ó
                for the content of the text box after calling the barcode routine. I will post an image of the result for those that can view it.

                Jim

                Comment

                • jimatqsi
                  Moderator Top Contributor
                  • Oct 2006
                  • 1293

                  #9
                  Here's an image of the resulting printed barcode


                  You might get a better view at
                  Last edited by jimatqsi; Sep 12 '13, 02:28 PM. Reason: need better view of the image

                  Comment

                  • jimatqsi
                    Moderator Top Contributor
                    • Oct 2006
                    • 1293

                    #10
                    And the code I'm using to fill the text box is
                    Code:
                    Me.SalesOrderNo_txt = Code128_Str(Me.SalesOrderNo)
                    Again, this is using the class code found in post 5 of this thread:
                    I'm trying to get Code 128 barcodes generated in Excel, through the use of VBA. I've found a VBA class that somebody made and shared via VBForums (subsequently modified to work with Excel VBA), but...


                    The only difference being I changed the name of the class from Class1 to BarCodes_cls so my public function reads like this:

                    Code:
                    Public Function Code128_Str(ByVal Str As String) As String
                    Dim c As BarCodes_cls
                    Set c = New BarCodes_cls
                    Code128_Str = c.Code128_Str(Str)
                    End Function
                    Jim

                    Comment

                    • zmbd
                      Recognized Expert Moderator Expert
                      • Mar 2012
                      • 5501

                      #11
                      Unless one just needs the data density or the entire 128 ASCII, why not use a Code 39 font. Quick and easy to use, easily found in highquality typeface for free on the net, no check digit to calculate Unless you Code39Mod43, usually a easy ASCII port for Uppercase and numerics, only a start and stop charactor to deal with instead of all of the rest of the junk, usually native to the barcode scanner.

                      jimatqsi
                      your images are blocked at my company IT gateway.
                      if you use the advanced button you can upload to bytes.com
                      Last edited by zmbd; Sep 12 '13, 03:13 PM.

                      Comment

                      • jimatqsi
                        Moderator Top Contributor
                        • Oct 2006
                        • 1293

                        #12
                        I don't know how I got steered to Code128. Probably Code39 will work as well. I'm going to try that. Thanks very much for the tip.

                        Jim

                        Comment

                        • jimatqsi
                          Moderator Top Contributor
                          • Oct 2006
                          • 1293

                          #13
                          Thanks, zmbd, that got me where I need to be. I think I chose Code128 because it's what is used in the documents created by Crystal Reports. There's a built-in Code128 function that is simple to use in CR. Trying to recreate the pick tix in Access led me to this problem.

                          Thanks to you and Rabbit both.

                          Jim

                          Comment

                          • zmbd
                            Recognized Expert Moderator Expert
                            • Mar 2012
                            • 5501

                            #14
                            YEA!
                            (in truth though, the Code128, looked like a really neat project to work on... if I had the time I'd be all over that!)

                            Comment

                            Working...