DAO Data Control with DB Grid.Validate Event. Save Argument Doesn't Work
Posted on 2001-06-06
Here is the problem:
1. I have a DAO Data control linked to a database and displayed through a DB Grid..
2. There is a message box in the validate event which pops up a message box when a record is selected for deletion. The message box says that records may not be deleted.
3. The message box does in fact pop up, but the record is still deleted afterwards, even though the Save argument is set to False.
4. I have made sure that the DB Grid property to allow deletions is set to true, in order to allow the box to pop up. In addition both the DB Grid controll and the DAO allow for records to be added. Here is the code in the validate event:
In debug, the vbDataActionDelete action value of 7 seems to be generated alright; however, no value seems to be generated for the Save. I have tried using Boolean values of 0 or 1 as well.
Private Sub Data1_validate( Action As Integer, Save As Integer)
If Action = vbDataActionDelete then
MsgBox "You may not delete a record!"
Save = False
Thanks for your consideration of the above.