Another issue is that if you attempt to delete a record that has a related record in another table, the Jet (Access) database engine will not allow the delete, and a run-time error will occur.If you don't trap the error, the program will crash.The Action argument tells you which particular action (Move First, Update, etc.) caused the Validate event to fire.The value of Action can be tested by comparing it to a literal integer value (1, 2, 3, etc.) or with its corresponding VB predefined constant (vb Data Action Move First, vb Data Action Update, etc.).You would typically use Data Changed as a first test to see if a particular field needs further validation (if the user did not change the data in a field, why bother doing further validation on that field?) The logic structure would look something like the following: The Cancel Update method is used to cancel any pending updates resulting from an Edit or Add New operation.
On your form, create a text box for each field in the Authors table, with labels.
This tutorial provides a brief introduction to developing database applications with Visual Basic through a series of nine step-by-step exercises.
It should be noted that these exercises use the Data control with other controls bound to it.
In addition, whatever action triggered the Validate event can be cancelled if you set the value of Action to zero (or to the predefined constant vb Data Action Cancel) prior to exiting the Validate event procedure.
The values of Action and their corresponding predefined constants are as follows: is a run-time only Boolean property available with data-bound controls (such as the textboxes you have been using), typically used in the Validate event.