
In Lotus Domino Designer, open or select your database.
When the database is open, to view a list of forms in the database, click Forms. The default database form is called Document, to edit it, double-click the name Document.
Place the cursor in your form, move to position to insert the bar code.
Select menu Create | Insert Shared Field... and select;
Barcode
Now the field is in the form, right-click the Barcode field, then select Text Properties... and click Paragraph Hide When tab. Use these settings;
[ ] Previewed for reading
[ ] Opened for reading
[ ] Printed
[ ] Previewed for editing
[ ] Opened for editing
- Click the Font tab.
- Use these settings;
| Font | CIA Code 128 Normal |
| Size | 14 |
| Style | Plain |
- Select menu View | Programmer's Pane.
- Click the Objects tab.
- Expand your form by clicking
Form name (Form).
- Under your form select (Options).
(Options)
Enter Lotus Script code;
Use "ciaxcom" |
We will create the bar code whe the form is saved. To do this we will use the Querysave event.
Querysave
Select event Querysave and this Lotus Script code will appear;
Sub Querysave(Source As Notesuidocument, Continue As Variant) End Sub |
Example: If we must print the date as an EAN-128 bar code, we use this function;
CIA_EAN128( ) |
Before we use any bar code function, we must first put our data in the correct format.
This code formats the date as yyyymmdd so that 01/01/2002 becomes 20020101. This format is more suitable for use in bar codes.
MyData = Trim(Source.FieldGetText ( "MyFielfd" )) MyBarcode = CIA_SSCC18 ( F00 ) Source.FieldSetText "Barcode", MyBarcode MyHuman = CIA_SSCC18_H ( F00 ) Source.FieldSetText "Human", MyData = Format ( Date, "yyyymmdd" ) |
Now variable MyData stores the formatted Date. Variable MyBarcode stores the calculated bar code. The bar code is then stored in a field called Barcode.
MyData = Format ( Date, "yyyymmdd" ) MyBarcode = CIA_EAN128 ( MyData ) Source.FieldSetText "Barcode", MyBarcode |
The same code can be simplified, without the use of variables;
Source.FieldSetText "Barcode", CIA_EAN128 ( Format ( Date, "yyyymmdd" ) ) |
This code can be used in a Querysave procedure of a form. When the form is saved the Barcode field is automatically updated with the correct bar code;
Sub Querysave(Source As Notesuidocument, Continue As Variant) Source.FieldSetText "Barcode", CIA_EAN128 ( Format ( Date, "yyyymmdd" ) ) End Sub |
Close the form.
|
Note: There is a function to create each type of bar code. For example, to create EAN-128 bar codes we use function CIA_EAN128(), to create Code 39 bar code we use function CIA_CODE39(). See: Bar code functions. |
Each function requires only a string argument;
CIA_EAN128( "MY-DATA" ) |
the string can be; a fixed string, a variable string, a field or any expression that evaluates to a string.
CIA_EAN128( Date ) |
The result of the function is a string. The result string contains the bar code characters. The result string can be stored in a string variable or a text field.
After the bar code is calculated using a function, the bar code string can be printed using the correct bar code font. For each type of bar code there is a special bar code font.
|
Note: For each bar code function, there is a font and font size to use. See: Bar code font name and font size to use to discover the font and font size to select. |
|
Copyright © 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited. |