Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

The Data Form Wizard

The Data Form Wizard analyzes a database, locates the fields for you (you don't have to know the format of the database ahead of time), and automatically builds a form that contains an appropriate title, field names, Text Box controls for the fields, and the Data control you can use to move between the records. If you want to follow along with this exercise, start a new VB project and remove any projects currently loaded in VB.

An add-in application is a tool that extends Visual Basic's development environment.

To access the Data Form Wizard, select Add-Ins | Add-In Manager. When the Add-In Manager dialog box appears, select the VB 6 Data Form Wizard and check the Loaded/Unloaded check box. Click OK to continue. Now select Add-Ins | Data Form Wizard. Visual Basic displays the Data Form Wizard's opening window. When you click Next, you see the database-selection dialog box shown in Figure 15.2.

15fig02.gif

Figure 15.2 The Data Form Wizard's database selection tool.

Continue following the wizard's requests to create the form. For example, you will have to tell the wizard the kind of database for which you want to create a form. After you select a database, the next dialog box asks you for the database name (which you can browse for) and a data source such as a table or query. Select the kind of form and then on the Record Source dialog box, you must select a table. Copy all the fields you want from that table to the final form. You then can click the options you want and click Finish to generate the form.

The form that the Data Form Wizard generates might not be as unique as the one you create yourself, but the form does include buttons that let the user not only change the database data, but also add and delete records as well, as Figure 15.3 shows.

15fig03.gif

Figure 15.3 The Data Form Wizard creates a nice form.

Share ThisShare This

Informit Network