Attribute VB_Name = "modBarcode" Option Explicit Public Function GetCode128(intAscii As Integer) As Integer If intAscii = 0 Then GetCode128 = 128 ElseIf intAscii > 0 And intAscii < 95 Then GetCode128 = intAscii + 32 ElseIf intAscii > 94 Then GetCode128 = intAscii + 50 End If End Function Public Function getCheckDigit(strBCVal As String) As String Dim intLength As Integer Dim intctr As Integer Dim intAscii As Integer Dim intCheckSum As Integer intCheckSum = 104 intLength = Len(strBCVal) For intctr = 1 To intLength Step 1 intAscii = Asc(Right(Left(strBCVal, intctr), 1)) intCheckSum = intCheckSum + (getAsciiLoc(intAscii) * intctr) Next getCheckDigit = Chr(GetCode128(intCheckSum Mod 103)) If getCheckDigit = "'" Then getCheckDigit = "''''" End Function Public Function getAsciiLoc(intAscii As Integer) As Integer If intAscii = 128 Then getAsciiLoc = 0 ElseIf intAscii > 32 And intAscii < 127 Then getAsciiLoc = intAscii - 32 ElseIf intAscii > 126 And intAscii <> 128 Then getAsciiLoc = intAscii - 50 End If End Function Public Function getBarcodeValue(strBCVal As String) As String getBarcodeValue = Chr(154) & strBCVal & getCheckDigit(strBCVal) & Chr(156) End Function