Calculating the PostNet Barcode Checksum in Access Basic
Home >
Barcode Basics >
Application Notes >
AppNote003
PostNet barcodes require a Modulo 10 check digit. This sample code accepts the zip code
and calculates the check digit. It does not check for embedded dashes or other illegal
characters, and it will process any length zip code.
Function Postnet_Checkdigit (InString As String) As Integer
Dim Sum As Integer, i As Integer, CheckDigit As Integer
Sum = 0
For i = 1 To Len(InString)
Sum = Sum + Val(Mid$(InString, i, 1))
Next i
CheckDigit = 10 - (Sum Mod 10)
If CheckDigit = 10 Then
CheckDigit = 0
End If
Postnet_Checkdigit = CheckDigit
End Function