![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!
Defining IndexesAlong with setting field properties, the Visual Data Manager also defines indexes in a database. To review briefly, an index is a logical sorting, or ordering, of the records in a table, based on the data contained in one or more fields. To define an index for a table, start the Visual Data Manager and open the database file (if necessary). Then:
The indexes to define for the GRAPEVINE database are shown in Table 22.1. For the database you are developing, use the techniques just described to define the indexes in Table 22.1.
The Validate EventA vital part of any well designed database program is validating the data being entered. By preventing the entry of invalid data, you can save a lot of headaches down the road. Certain kinds of validation can be accomplished by using the field objects validation properties, as discussed earlier in the chapter. Considering the limitations of these properties, I have found the Validate event to be much more useful. This event applies to a wide variety of controlsanything that you would possibly use for data entry/editing in a database project. The Validate event works in tandem with the CausesValidation property. If the focus is moved from one control to another, the first controls Validate event is fired if the second controls CausesValidation property is True. Heres an example. You have a data entry form with a Text Box that is bound to an ADO Data control. The form also has an OK Command Button to confirm data entry, and a Help Command Button to display help information. Set the CausesValidation property to True for the OK button and to False for the Help button. If the user enters or edits data in the Text Box and then clicks on the OK button, the Text Boxs Validate event is fired, and code in the event procedure can be used to validate the data. In contrast, if the user clicks on the Help button, the Validate event is not fired. The Validate event procedure has the following structure: Private Sub object_Validate(KeepFocus As Boolean) ... End Sub
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |