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.
- On the View menu, click Design View.
- Right-click the Code text box, and then click Properties on the shortcut menu.
- 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). - Click the Data tab, and then change the control source from Code to the following:
="*" & [Code] & "*"
NOTE: The name in brackets should be the name of the data control source, not the word "Code". - Click the Format tab, and then change the font to your bar code font.
- Preview the report, noting that the bar codes are displayed correctly.
Form
- Select the tblBarCodes table. On the Insert menu, click AutoForm.
- On the View menu, click Design View.
- Right-click the Code text box, and then click Properties on the shortcut menu.
- 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). - Click the Data tab, and then change the control source from Code to the following:
="*" & [Code] & "*"
NOTE: The name in brackets should be the name of the data control source, not the word "Code".
- Click the Format tab, and then change the font to your bar code font.
- Preview the form, noting that the bar codes are displayed correctly.
Data Access Page
- Select the tblBarCodes table. On the Insert menu, click Page.
- In the dialog box that appears, select AutoPage/Columnar. Make sure that tblBarCodes is selected in the list in the lower right corner.
- On the View menu, click Design View.
- Right-click the Code text box, and then click Properties on the shortcut menu.
- 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). - Click the Data tab, and then change the control source from Code to the following:
="*" & [Code] & "*"
NOTE: The name in brackets should be the name of the data control source, not the word "Code". - 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.
- Preview the data access page, noting that the bar codes are displayed correctly.