Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checksum - Sum of Bytes Codes - How-To

Status
Not open for further replies.

charcurley

Programmer
Aug 16, 2001
29
0
0
I have written code for a barcode in a Report. The barcode has to end with a single parameter a Check Sum. Instructions read(it is a sum of byte codes, starting with the first byte and including the tab delimiter right before the Check Sum parameter). This is where I am stuck at the moment. Any help on accomplishing this would be greatly appreciated!
 
Well, you will need to build a function to cycle through your value. The trick is to know when to run the function.

I am using code 128B and had to do the same thing. I put the data on my table, but on my reports, called a function with the data. The function is like the following:

Public Function CD(M As String)
X = Len(M)
Z = 0
For I = 1 To X
Z = Z + (Asc(Mid(M, I, 1)) - 32) * I
Next I
F = Z Mod 103
F = F + 32
CD = M & Chr(F)
End Function

Note that I had to take the total checksum, which is Z after the for loop, and get the remainder.

A slight modification should work for you.

ChaZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top