Imprimir página | Fechar Janela

Código de barra EAN13

De:: Portal eXpertAccess
Categoria: Grupo de Discussão Microsoft Access
Nome do fórum: Access Avançado
Descrição:: Para usuários avançados que queiram trocar experiências e tirar suas dúvidas
URL:: http://www.expertaccess.com.br/forumnew/forum_posts.asp?TID=2447
Data:: 23 Mai 2013 as 06:31
Versão do Software: Web Wiz Forums 9.60 - http://www.webwizforums.com


Tópico: Código de barra EAN13
Enviado por: JOEL
Assunto: Código de barra EAN13
Data: 03 Mar 2005 as 13:33

Olá Pessoal

Por favor, alguém tem alguma rotina que gere o código EAN13. O CODE39 já tenho, fica muito grande com os 13 dígitos do EAN13.

Um abraço




Respostas:
Enviado por: ABADVINCULA
Data: 03 Mar 2005 as 15:58

Olá JOEL, boa tarde.

Eu tenho um OCX Free ( Grátis ) que peguei na net que gera código de barras nos padrões Code39, EAN13, EAN8 e I2x5.

Se te interessar me manda um e-mail que te mando a OCX.



-------------
T+, []

Alessandro Bezerra Advíncula


Enviado por: JOEL
Data: 05 Mar 2005 as 12:11

Olá Abadvincula

O meu e-mail é mailto:joelmoscatolli@ig.com.br - joelmoscatolli@ig.com.br

Agradeço muito a atenção

Um abraço



Enviado por: ABADVINCULA
Data: 10 Mar 2005 as 13:23

Arquivo enviado ...

Poste aqui os seus resultados ...



-------------
T+, []

Alessandro Bezerra Advíncula


Enviado por: JOEL
Data: 11 Mar 2005 as 16:26

Olá Alessandro

Obrigado pelo arquivo

No momento estou "full" em outro projeto então ainda não tive tempo de usar o OCX, mas assim que conseguir lhe envio uma resposta.

Grande abraço



Enviado por: MMOURAO
Data: 22 Out 2012 as 16:41
você pode me manda o ocx do código de barras?
mmourao@mmourao.com


Enviado por: Mc Feba
Data: 23 Out 2012 as 17:39
Oi Joel ....
 
Se precisar de outro exemplo veja este.
 
Public Function EAN13(DataToEncode As String) As String
    DataToPrint = ""
    OnlyCorrectData = ""
    'Check to make sure data is numeric and remove dashes, etc.
    StringLength = Len(DataToEncode)
    For I = 1 To StringLength
         'Add all numbers to OnlyCorrectData string
         '2006.2 BDA modified the next 3 lines for compatibility with different office versions
         'If IsNumeric(Mid(DataToEncode, I, 1)) Then OnlyCorrectData = OnlyCorrectData & Mid(DataToEncode, I, 1)
         CurrentCharNum = AscW(Mid(DataToEncode, I, 1))
         If CurrentCharNum > 47 And CurrentCharNum < 58 Then OnlyCorrectData = OnlyCorrectData & Mid(DataToEncode, I, 1)
    Next I
    '2006.2 BDA added the next line for general compatibility
    StringLength = Len(OnlyCorrectData)
    If StringLength < 12 Then OnlyCorrectData = "0000000000000"
    If StringLength = 16 Then OnlyCorrectData = "0000000000000"
    If StringLength = 13 Then OnlyCorrectData = Mid(OnlyCorrectData, 1, 12)
    If StringLength = 15 Then OnlyCorrectData = (Mid(OnlyCorrectData, 1, 12) & Mid(OnlyCorrectData, 14, 2))
    If StringLength > 17 Then OnlyCorrectData = (Mid(OnlyCorrectData, 1, 12) & Mid(OnlyCorrectData, 14, 5))
    Dim EAN2AddOn As String
    Dim EAN5AddOn As String
    EAN2AddOn = ""
    EAN5AddOn = ""
    '2006.2 BDA added the next line for general compatibility
    StringLength = Len(OnlyCorrectData)
    If StringLength = 17 Then EAN5AddOn = Mid(OnlyCorrectData, 13, 5)
    If StringLength = 14 Then EAN2AddOn = Mid(OnlyCorrectData, 13, 2)
    'Remove digit number from add-ons and check digit
    DataToEncode = Mid(OnlyCorrectData, 1, 12)
    'Calculate Check Digit
    Factor = 3
    WeightedTotal = 0
    For I = Len(DataToEncode) To 1 Step -1
        'Get the value of each number starting at the end
        CurrentCharNum = Mid(DataToEncode, I, 1)
        'Multiply by the weighting factor which is 3,1,3,1...
        'and add the sum together
        WeightedTotal = WeightedTotal + CurrentCharNum * Factor
        'Change factor for next calculation
        Factor = 4 - Factor
    Next I
    'Find the CheckDigit by finding the number + WeightedTotal that = a multiple of 10
    'Divide by 10, get the remainder and subtract from 10
    I = (WeightedTotal Mod 10)
    If I <> 0 Then
        CheckDigit = (10 - I)
    Else
        CheckDigit = 0
    End If
    'Encode the leading digit into the left half of the EAN-13 symbol
    'by using variable parity between character sets A and B
    LeadingDigit = Mid(DataToEncode, 1, 1)
    Select Case LeadingDigit
    Case 0
    Encoding = "AAAAAACCCCCC"
    Case 1
    Encoding = "AABABBCCCCCC"
    Case 2
    Encoding = "AABBABCCCCCC"
    Case 3
    Encoding = "AABBBACCCCCC"
    Case 4
    Encoding = "ABAABBCCCCCC"
    Case 5
    Encoding = "ABBAABCCCCCC"
    Case 6
    Encoding = "ABBBAACCCCCC"
    Case 7
    Encoding = "ABABABCCCCCC"
    Case 8
    Encoding = "ABABBACCCCCC"
    Case 9
    Encoding = "ABBABACCCCCC"
    End Select
    'Add the check digit to the end of the barcode & remove the leading digit
    DataToEncode = Mid(DataToEncode, 2, 11) & CheckDigit
    'Determine character to print for proper barcoding
    StringLength = Len(DataToEncode)
    For I = 1 To StringLength
    'Get the ASCII value of each number excluding the first number because
    'it is encoded with variable parity
    CurrentCharNum = AscW(Mid(DataToEncode, I, 1))
    CurrentEncoding = Mid(Encoding, I, 1)
    'Print different barcodes according to the location of the CurrentChar and CurrentEncoding
    Select Case CurrentEncoding
    Case "A"
         DataToPrint = DataToPrint & ChrW(CurrentCharNum)
    Case "B"
         DataToPrint = DataToPrint & ChrW(CurrentCharNum + 17)
    Case "C"
         DataToPrint = DataToPrint & ChrW(CurrentCharNum + 27)
    End Select
    'Add in the 1st character along with guard patterns
    Select Case I
    Case 1
        'For the LeadingDigit, print the human readable character,
        'the normal guard pattern, and then the rest of the barcode
        If LeadingDigit > 4 Then DataToPrint = ChrW((LeadingDigit + 48) + 64) & "(" & DataToPrint
        If LeadingDigit < 5 Then DataToPrint = ChrW((LeadingDigit + 48) + 37) & "(" & DataToPrint
    Case 6
        'Print the center guard pattern after the 6th character
        DataToPrint = DataToPrint & "*"
    Case 12
        'For the last character (12), print the the normal guard pattern after the barcode
        DataToPrint = DataToPrint & "("
    End Select
    Next I
    'Process add-ons if they exist
    If Len(EAN2AddOn) = 2 Then DataToPrint = DataToPrint & " " & ProcessEAN2AddOn(EAN2AddOn)
    If Len(EAN5AddOn) = 5 Then DataToPrint = DataToPrint & " " & ProcessEAN5AddOn(EAN5AddOn)
    'Return PrintableString
    EAN13 = DataToPrint
End Function
 
 
Abraços,


-------------
"O primeiro sinal de ignorância é presumirmos que sabemos"

http://www.esnips.com/web/alexandroandrade-Access - http://www.esnips.com/web/alexandroandrade-Access



Imprimir página | Fechar Janela

Bulletin Board Software by Web Wiz Forums® version 9.60 - http://www.webwizforums.com
Copyright ©2001-2009 Web Wiz - http://www.webwizguide.com