×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to use EAN13 module in Access 2003 reports

How to use EAN13 module in Access 2003 reports

How to use EAN13 module in Access 2003 reports

(OP)
Hi there,
I have been reading through these forums (very informative).

I am wanting to print a companies full product list as a report (from a product database i have), instead of numerically writing the barcode i would like to show the graphic too.

I found alot of references to the following site which has the module code:
http://grandzebu.net/index.php?page=/informatique/codbar-en/codbar.htm

I have created a module using the code from this site (called EAN13) and installed the font (ean13).


Could anyone tell me how i can get the module to run on a textbox (called BARCODE) on my report (called BARCODETEST).
I tried the following line in the textboxes control source:
=EAN13([BARCODE])
...and have changed the font to Code EAN13
But this does not work.


Any help is greatly appreciated
Thanks
Graham

RE: How to use EAN13 module in Access 2003 reports

graham,
Don't forget to name the function different from the module. If your module is ean13() then the function in the module should be UPCean13() or any other name besides "ean13". change all the references in the module to reflect "mynumber."
Example:

CODE

Function upcean13(ByVal mynumber)
If Len(mynumber) = 13 Then mynumber = Mid(mynumber, 1, 11)

  Dim I%, checksum%, first%, EAN13$, tableA As Boolean
 
  'VĂ©rifier qu'il y a 12 caractères
  If Len(mynumber) = 12 Then
    'Et que ce sont bien des chiffres
    mynumber = "0" & Mid$(mynumber, 1, 12)
Set the font size to about 38pts and adjust the textbox size accordingly.
jim

RE: How to use EAN13 module in Access 2003 reports

(OP)
Hi Jim
Thanks for the fast reply.
I have tried making the changes you advised, but there is still no barcodes being displayed.
I have attached my modules code, please let me know where i am going wrong.


CODE

Option Compare Database

Public Function MYEAN13$(ByVal mynumber)
  'This function is governed by the GNU Lesser General Public License (GNU LGPL)
  'V 1.1.1
  'Parameters : a 12 digits length string
  'Return : * a string which give the bar code when it is dispayed with EAN13.TTF font
  '         * an empty string if the supplied parameter is no good
  Dim i%, checksum%, first%, CodeBarre$, tableA As Boolean
  MYEAN13$ = ""
  'Check for 12 characters
  If Len(mynumber) = 12 Then
    'And they are really digits
    For i% = 1 To 12
      If Asc(Mid$(mynumber, i%, 1)) < 48 Or Asc(Mid$(mynumber, i%, 1)) > 57 Then
        i% = 0
        Exit For
      End If
    Next
    If i% = 13 Then
      'Calculation of the checksum
      For i% = 12 To 1 Step -2
        checksum% = checksum% + Val(Mid$(mynumber, i%, 1))
      Next
      checksum% = checksum% * 3
      For i% = 11 To 1 Step -2
        checksum% = checksum% + Val(Mid$(mynumber, i%, 1))
      Next
      mynumber = mynumber & (10 - checksum% Mod 10) Mod 10
      'The first digit is taken just as it is, the second one come from table A
      CodeBarre$ = Left$(mynumber, 1) & Chr$(65 + Val(Mid$(mynumber, 2, 1)))
      first% = Val(Left$(mynumber, 1))
      For i% = 3 To 7
        tableA = False
         Select Case i%
         Case 3
           Select Case first%
           Case 0 To 3
             tableA = True
           End Select
         Case 4
           Select Case first%
           Case 0, 4, 7, 8
             tableA = True
           End Select
         Case 5
           Select Case first%
           Case 0, 1, 4, 5, 9
             tableA = True
           End Select
         Case 6
           Select Case first%
           Case 0, 2, 5, 6, 7
             tableA = True
           End Select
         Case 7
           Select Case first%
           Case 0, 3, 6, 8, 9
             tableA = True
           End Select
         End Select
       If tableA Then
         CodeBarre$ = CodeBarre$ & Chr$(65 + Val(Mid$(mynumber, i%, 1)))
       Else
         CodeBarre$ = CodeBarre$ & Chr$(75 + Val(Mid$(mynumber, i%, 1)))
       End If
     Next
      CodeBarre$ = CodeBarre$ & "*"   'Add middle separator
      For i% = 8 To 13
        CodeBarre$ = CodeBarre$ & Chr$(97 + Val(Mid$(mynumber, i%, 1)))
      Next
      CodeBarre$ = CodeBarre$ & "+"   'Add end mark
      MYEAN13$ = CodeBarre$
    End If
  End If
End Function

Regards
Graham

RE: How to use EAN13 module in Access 2003 reports

(OP)
Hi again,

I have just retested...
and it is working, but only if the barcode is 12 digits.
I really need this to work with a 13 digit number, does anyone know how to amend the code to work with 13 digits

Thanks
Graham

RE: How to use EAN13 module in Access 2003 reports

(OP)
***UPDATE***

Hi there,
I have changed the line

CODE

If Len(mynumber) = 12 Then
to

CODE

If Len(mynumber) = 13 Then

Now the barcodes are displaying great, thank you very much for your help.

Does anyone know if there is a short version of the EAN13 font?
I need a barcode that takes up less room for ticketing.

Thanks
Graham

RE: How to use EAN13 module in Access 2003 reports

graham,
 I am just fooling around with my ean13, 99.9% of ours are UPCA and I just have the ean13 figure it out for fun. My scanner automatically converts the EAN13's to UPC-A's.(I guess they are going to convert all UPC-A's to EAN13 sometime in the future, unless RFID takes over.)
The size of the barcode depends on your scanner. If it is a "LASER" scanner it will read very small lines (spaces acutally) and the printer is also a factor. A laserjet, or a barcode printer, of course, would be the best. We have some barcodes included with our products that measure slightly less than 15mm and my symbol p304 pro reads them the first shot. We also have a WA5700A that will read the small ones most of the time.
Try reducing the font size to 28 and see if the scanner will read it. Then increase the font a couple of points until the scanner reads...
jim

RE: How to use EAN13 module in Access 2003 reports

(OP)
Thanks again for all the advice.

I managed to get the font size down to 20, and the barcodes are still printing/scanning fine.
I also found i could leave the font size and just reduce the textbox height if i wanted shorter/thinner barcodes for labels.

Regards
Graham

RE: How to use EAN13 module in Access 2003 reports

graham,
Happy to hear you got it working. Glad to help.
jim

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close