Designing forms to print bar codes

Designing a form to print bar codes is very similar to designing a report to print bar codes.

 

Before you can design forms, you must install JIT-SBP for use with Superbase;

See: Installing for use with Superbase

 

Loading our Superbase bar code library

Before you design or run a form or report that contains bar codes, you must load our Superbase bar code library CIAXCOM.SBP

See: Loading our Superbase bar code library

Now your programs can use the bar code functions in CIAXCOM.SBP

 

To print bar codes in a form, we must add a Text Box to the form.

1) Adding a Text Box to your form

To add a Text Box to the form;

- Open your form, or create a new form.

- Create a Text Box in your form - using these tools;

Text Box

or

Display Text Box (can be rotated)

 

- In the Text Box Properties dialog;

- Enter a$ in the Field name box.

Note: You can use any unique variable name. We have used a$ in this example.

 

2) Entering a Calculation Formula

To enter a calculation formula;

- Click the Calculation button.

Note: The Calculation button is only enabled when you enter a variable name.

In this example, we want to create a type of bar code called Interleaved 2-of-5 (ITF).

Note: For each type of bar code, there is a specific function to use. For Code 128 the function is CIA_CODE128$( ), for Interleaved 2-of-5 (ITF) the function is CIA_ITF$( ), ...

See: Bar code functions.

We must use function CIA_ITF$( ) to calculate bar code type Interleaved 2-of-5 (ITF).

Note: All bar code functions take a single parameter, that is used to create the bar code. This parameter is a string, or field, or expression which evaluates to a string type.

In this example, we use a field as the parameter;

MyField.MYTABLE

The complete formula is;

CIA_ITF$( MyField.MYTABLE )

- Click OK.

- Click OK again.

Now you see a Text Box in your form.

 

3) Before selecting a bar code font - test your form

Add any other data fields to your form.

TIP: So you can see the original data values, add to the form all fields used by the bar code function (i.e. MyField.MYTABLE).

- Save your form.

- Display or print your form.

A window called Barcode errors will appear and display any error messages.

Your form should display / print your regular data fields.

Check your regular data fields are displaying / printing correct values - before you check the bar codes Text Box.

Your form should display / print a string produced by bar code Text Box.

If this is correct, go to 4) Selecting a font, otherwise read section Troubleshooting

 

Troubleshooting

If the bar code Text Box does not display / print a bar code string, you can;

(a) If there is a window called Barcode errors, select this window. It will display any error messages returned by the bar code functions.

(b) Some types of bar code (UPC-A, EAN-8, EAN-13, ITF-14, SCC-14, SSCC-18) require a fixed length. Check your data values are the correct length.

(d) Check what you have done.

 

4) Selecting a font

When your form is correctly calculating the bar code Text Box, then you can select a bar code font to display / print the Text Box as a bar code.

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.

- Select your bar code Text Box, that contains your variable a$

- Select menu Define | Font...

- Set Font to font name; CIA ITF Medium

- Set Font Style to style; Regular

- Set Size to font size; 14

Note: During design, the Text Box displays a$ (i.e. not the bar code result), so you may see some strange characters (boxes) - this is correct. The correct bar code is only displayed when you display / print the form.

- Set the height and the width of the Text Box.

IMPORTANT: Set the width of the Text Box to the maximum width possible (to avoid clipping of the bar code).

To confirm the properties, select the Text Box, and to view the properties press F4.

ControlSource 
a$
Calculation 
CIA_ITF$( FIELD.TABLE )
FontName 
CIA ITF Medium
FontBold 
False
FontItalic 
False
FontSize 
14

 

5) Save and print your form

Save your form, then display or print your form.

 

6) Entering data in form fields

Before you enter data, you should load our Superbase bar code library CIAXCOM.SBP

See: Loading our Superbase bar code library

Note: Usually, you will create a Superbase program to load the library and open the form for entering data.

The bar code Text Box is calculated automatically when;

 

See: Trapping errors for advice about trapping error messages in Superbase programs.

See: TIPS for advice and useful information about reading bar codes.

 


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