Microsoft KB Archive/271622

= ACC2000: How to Format Controls to Display Bar Code Fonts =

Article ID: 271622

Article Last Modified on 7/14/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q271622



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
In a Microsoft Access 2000 database, you can display bar codes on forms, reports, and data access pages (embedded fonts only). This display functionality is most often used in reports, but the report formatting depends on the way that the data is entered and stored in the underlying tables.

To correctly display bar codes, the control field must contain not only the numbers and dash (for example, 71043-1643) but also the asterisks on each side of the number (for example, *71043-1643*). To minimize the amount of data stored in the database, the preferred method for correctly displaying bar codes is to format the control properties of the field on the report or form, not in the underlying field in the table.



MORE INFORMATION
Because the raw table data probably does not contain the necessary asterisks, follow these steps to create the table and populate it with data.   Create the following table.   Table: tblBarCodes Field Name: ID  Data Type: AutoNumber

Field Name: Code Data Type: Text  Save the table and name it tblBarCodes . Open the table in Datasheet view.  Type the following records:   ID    Code 1    71043-1643    2     71043-1655    3     71043-1617    4     71043-1633    5     71043-1634    6     71043-1699                    

The following sets of instructions demonstrate how to format the properties of the control on a report, a form, or a data access page. In order for these instructions to work correctly, the bar code font must be installed on your computer.

Report
 Select the tblBarCodes table. On the Insert menu, click AutoReport.</li> On the View menu, click Design View.</li> Right-click the Code text box, and then click Properties on the shortcut menu.</li> Click the Other tab, and then change the name of the control to txtCode.

NOTE: The bar code may not appear correctly if the name of the control field on the report is the same as the field in the control source (tblBarCodes).</li> Click the Data tab, and then change the control source from Code to the following:

=&quot;*&quot; & [Code] & &quot;*&quot;

NOTE: The name in brackets should be the name of the data control source, not the word &quot;Code&quot;.</li> Click the Format tab, and then change the font to your bar code font.</li> Preview the report, noting that the bar codes are displayed correctly.</li></ol>

Form
 Select the tblBarCodes table. On the Insert menu, click AutoForm.</li> On the View menu, click Design View.</li> Right-click the Code text box, and then click Properties on the shortcut menu.</li> Click the Other tab, and then change the name of the control to txtCode.

NOTE: The bar code may not appear correctly if the name of the control field on the form is the same as the field in the control source (tblBarCodes).</li> Click the Data tab, and then change the control source from Code to the following:

=&quot;*&quot; & [Code] & &quot;*&quot;

NOTE: The name in brackets should be the name of the data control source, not the word &quot;Code&quot;.</li> Click the Format tab, and then change the font to your bar code font.</li> Preview the form, noting that the bar codes are displayed correctly.</li></ol>

Data Access Page
<ol> <li>Select the tblBarCodes table. On the Insert menu, click Page.</li> <li>In the dialog box that appears, select AutoPage/Columnar. Make sure that tblBarCodes is selected in the list in the lower right corner.</li> <li>On the View menu, click Design View.</li> <li>Right-click the Code text box, and then click Properties on the shortcut menu.</li> <li>Click the Other tab, and then change the ID of the control to txtCode.

NOTE: The bar code may not appear correctly if the ID of the control field on the data access page is the same as the field in the control source (tblBarCodes).</li> <li>Click the Data tab, and then change the control source from Code to the following:

=&quot;*&quot; & [Code] & &quot;*&quot;

NOTE: The name in brackets should be the name of the data control source, not the word &quot;Code&quot;.</li> <li>Click the Format tab, and then either select your font name from the Formatting toolbar, or type the exact name of your bar code font in the Font Family box.</li> <li>Preview the data access page, noting that the bar codes are displayed correctly.</li></ol>

Additional query words: coding upc fonts formatted formats show web page scan scanning scanned scanner

Keywords: kbinfo KB271622

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.