Home
SEARCH

 

Using the TAL Bar Code ActiveX Control with a VB Data Report


  Contents

Problem
Solution
Creating the Data Environment
Creating the Data Report
Adding Bar Codes to the Report
Conclusions

Download the completed Project with source code

Problem

When most VB Programmers think about adding report generation to their applications they will often overlook the built in Data Reporting tool. While Data Reports do not support ActiveX controls directly, this tool can be used in conjunction with the TAL Bar Code ActiveX Control to add a perfect bar code to a report.

Solution

The following example walks you through the process of creating a simple report based on the NorthWind Database that comes with Visual Basic. Before you begin the step-by-step process, ensure that the Northwind database (Nwind.mdb) is present on your computer. If it is not present, copy the file from your Visual Basic CD onto your hard disk.

Creating the Data Environment.

In Visual Basic, create a new Standard EXE project.

On the Project menu, click Add Data Environment to add a designer to your project. If the designer is not listed on the Project menu, click Components. Click the Designers tab, and click Data Environment to add the designer to the menu.
Note: The first four kinds of ActiveX designers loaded for a project are listed on the Project menu. If more than four designers are loaded, the later ones will be available from the More ActiveX Designers submenu on the Project menu.

On the Data Link Properties dialog box, click Microsoft Jet 3.51 OLE DB Provider.

Click the Next button to get to the Connection tab.



Click the ellipsis button (…) next to the first text box and use the Select Access Database dialog box to navigate to the nwind.mdb file, which is installed in the Program Files\Microsoft Visual Studio\Vb98 directory. Then click OK to close the dialog box.

Right-click the Connection1 icon, and click Rename. Change the name of the icon to Northwind.

Right-click the Northwind icon, and then click Add Command to display the Command properties dialog box. In the dialog box, set the properties as shown below:



Click OK to close the dialog box. After closing the dialog box, the Data Environment designer reflects the Customers Table:



Set the properties of the project and designer according to the settings below, then save the project:

Object Property Setting
Project Name prjNwind
DataEnvironment Name deNwind
Form Name frmShowReport

Next Page

Back to Code Samples