CIA_FillBarcodeFieldInTable 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_FillBarcodeFieldInTable( )

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

- Add a Button 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 Button object is displayed
- Click the Button object name (or press Enter)
- In the Script dropdown box, select Change. The following code will then appear;

Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)

End Sub

- Edit the code to look like this;

Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)

	CIA_FillBarcodeFieldInTable "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.

- When you click the Button that you added to the form, ClientNoBarcode should update for all records automatically.

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.