CIA_FillBarcodeField BarcodeType, SourceFld, TargetFld

In this typical example, we use a database called Example. The database contains a field called ClientNo and we wish to print the field as a bar code.

Adding a bar code field to a table

To print ClientNo as a bar code we must store the bar code in another field. In this example, we will use menu Create | Field Definition to add a new Text field called ClientNoBarcode to the database.

This general rule gives the minimum size for the new field;

ClientNoBarcode Size = ( 2 x ClientNo Size ) + 10

Example: If ClientNo is 10 characters, ClientNoBarcode must be 30 characters.

Calling CIA_FillBarcodeField

- Add the ClientNo and ClientNoBarcode fields to your database form.

- Press Ctrl+K to open the LotusScript editor (or menu Edit | Show Script Editor).

- In the Object dropdown box, select (Globals) and in the Script box select (Declarations).

- Enter this statement to include the bar code functions from the LotusScript file;

%INCLUDE "CIAXCOM.LSS"

- In the Object dropdown box, use the cursor key to move down to the database object - in this example the database is called Example.

To expand each object, press the + key (or click small arrow on left of object name).

- Expand objects until the ClientNo field object is displayed
- Click on ClientNo field object name (or press Enter)
- In the Script dropdown box, select Change. The following code will then appear;

Sub Change(Source As Fieldbox)

End Sub

- Edit the code to look like this;

Sub Change(Source As Fieldbox)
	CIA_FillBarcodeField "C39-0.B", "ClientNo", "ClientNoBarcode"
End Sub

Note: In the above example, "C39-0.B" specifies the bar code type to produce. See Specifying a bar code type for a complete list.

- In the Script Editor use File | Save (or Ctrl+S) to save your .APR database file and then File | Close Script Editor to go back to the form.

- To print the ClientNoBarcode field as a bar code, right-click the object and click Object Properties (or select the object and press Alt+Enter).

- In the Properties box, select a TrueType bar code font for the bar code type. See Specifying a bar code type for a complete list of font names and sizes.

Testing

- While in the database form, click Browse.

- Now enter text in the ClientNo field. When you move from the ClientNo field ClientNoBarcode will update automatically.

Note: If you press Ctrl+R to Refresh Data, this will also force fields to update.

- Use File | Print (or Ctrl+P) if you want to print your form.

See Adding bar code fields to views to see how to print the new bar code field in; Forms, Labels, Reports, Envelopes and Form Letters.

 


Copyright 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.