Now you will construct a Microsoft Access database. The database will contain important information about the registrants and the costs they incur. You can build the database either by using Microsoft Access directly or by using the Data Manager included with Visual Basic. For this exercise, you will create the data base by using the Data Manager. If you prefer to create the database in Access, you can do so and then return to the exercise at the "Defining the Datasource" section. In any case, you will create a database with the structure shown in Table 7-1.
Table 7-1. The Registrations Table
Field Name | Data Type |
Name | Text |
Company | Text |
Address | Text |
City | Text |
State | Text |
Zip | Text |
Text | |
CardType | Text |
CardNumber | Text |
CardExpDate | Text |
Ticket | Text |
Shirt | Text |
Hat | Text |
Mug | Text |
Total | Text |
Start Visual Basic 4.0. Open the Data Manager by selecting Add-Ins/Data Manager from the Visual Basic menu bar. The Data Manager will start, and you will see a form with File and Help menus.
Create a new database by selecting New Database from the File menu. After the New Database dialog box appears, navigate to the folder \bookdata\project2, type in the filename eventreg.mdb, and click on the OK (or Save) button.
Add a new table to the database by clicking on the New button. The Add Table dialog box should appear. Name the new table Registrations.
Add the fields from Table 7-1 to the database one at a time by filling in the Field Name text box with the appropriate name. For each field, select Text from the Data Type combo box and set the field size to 250. Click on the right arrow button to add each field. The fields will appear in the list box in the center of the dialog box. Figure 7-3 shows the completed Registrations table in the Add Table dialog box.
Figure 7-3.
The Add Table dialog box showing the completed Registrations table.
Click on the OK button in the Add Table dialog box. The Registrations table should appear in the Data Manager. Figure 7-4 shows the event registration database with the Registrations table added. Minimize the Data Manager so that you can access the database directly anytime during the exercise. When you are working with ODBC drivers, direct access via the Data Manager can be helpful for troubleshooting.
Figure 7-4.
The event registration database with the Registrations table added.