# Vb Script Help On A Multi Output Custom Check Digit S’abonner

I am currently using BarTender V.9.01 and I am able to construct simple custom check digits. The problem I just encountered is that I was given a copy of a check digit algorithm from a database and told to convert it over to VB script to use in the Custom Check digit option of BarTender. I am really stumped on where to even begin, if anyone can help me I would really appreciate it. The basic concept of the check digit outcome is this: I need it to produce a 2 digit check digits for the input number, and I will also need a 3 digit check-digit for the same number. Also, it has to be alpha numeric and incorporate ACII. I know this is not much to go on, but I have attached a copy of the data base exported algorithms. It looks to have came from a SQL database. Thanks for any help anyone can give on this.

##### 6 commentaires

###### Fernando Ramos Miracle

ModérateurHello James,

I've taken a look at your PDF and transcript it to VB Script for you. You'll find a document attached with both check digits. I've also atached the actual script on separate .txt files (both check digits and the custom "Mod" function I needed to create).

Things to consider:

1. Only the three number check digit applies a control over what data is being entered (following the instructions on your PDF). I've added the script for it on this check digit, but it's easier to simply apply a character filter in BarTender so only alphanumeric values can be entered (or a custom filter to also add "." and "-").

2. Due to the limit of the "double" type data, both check digits can only be calculated over values under a certain maximum value (note that "Alpha" values will be substituted by two character numbers). If the entered value ends up being a number greater than the maximum the result will be "0" (for the 2 numbers check digit) or "1" (for the three numbers check digit).

3. Note that the script is set in both the "OnAutoSelectedEvent" and "OnPrintStart" events.

4. The variables and the required custom "Mod" function are specified in the "Functions and Subs" event.

Cheers.

Fernando,

Thank you so much for you help. I had to do a little tweaking but everything is working great, thanks again. On the 2ChekDigit, for the "calc = MyMod(MyMod(CDbl(result)*100, 97), 97)" line I added

"98-"; the changed line now reads; "calc = MyMod(98- MyMod(CDbl(result)*100, 97), 97)"

For the 3CheckDigit I had to add "result = Right(result, 10)" above the "calc = MyMod((998 - MyMod((CDbl(Right(result, 16))*1000),997)), 997)" Line. This was to account for the fact that it only needed to go up to 10 digits to the right, but still change all 15 of the digits in the number.

James

hi

Fernandocould u please help me with vb script. i have bar code IMEI with code 128C. i cant use another code type. how i can remove leading zero from my IMEI bar code.

that after printing, scanner will read only IMEI number without leading zero

thanks

Hello Petruha,

Could you let me know how many characters are you entering in the barcode? Please note that the code set C of the Code 128 symbology encodes values in pairs. If you've entered an odd number of characters it will always add a leading zero. This is a symbology specification and cannot be avoided. If you want to prevent this leading zero you'll need to use a different code set or configure your scanner to ignore it (if at all possible).

Regards.

yep, could u suggest another code type for IMEI number (it includes is 15 digits). the problem is that a label has a dimensional limits for printing bar code. i tried different code types and they are too big for label , or too small for scanner recognition.

the optimal parameters in my label : X dimension 0.25 mm and Char density is 0.727 ch/mm. (code 128C)

You could try a 2D barcode instead of a linear one (such as Data Matrix, QR codes, PDF417...), the latter are able to represent way more data per area unit.

Regards

Vous devez vous connecter pour laisser un commentaire.