Solved

DAO Data Control with DB Grid.Validate Event. Save Argument Doesn't Work

Posted on 2001-06-06
5
197 Views
Last Modified: 2012-08-13
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
End If

End Sub

Thanks for your consideration of the above.

Larry Kahn
0
Comment
Question by:larkahn
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
AndrewDev earned 300 total points
ID: 6161648
Take a look at this article
http://support.microsoft.com/support/kb/articles/Q175/9/49.ASP

I think it may help
Regards
Andrew
0
 

Author Comment

by:larkahn
ID: 6161863
Unfortunately, the article above only shows the list of action parameter settings. As mentioned, the delete value of 7 is generated, which is mentioned on the chart. What I would like to know is why the Save as Integer argument doesn't seem to work. I can't find anything in the help or article.

Larry Kahn
0
 
LVL 5

Expert Comment

by:AndrewDev
ID: 6163620
Guessing a bit but is that argument one of the 22 additional possible notifications mentioned in the article

Regards
Andrew
0
 

Author Comment

by:larkahn
ID: 6163960
I don't think so. I assume that the argument allows the user to back out of the vbAction that triggered the validate. I thought that setting it to false would mean that the action basically is cancelled and not in effect validated. It doesn't seem to work, though.
0
 
LVL 5

Expert Comment

by:AndrewDev
ID: 6164184
I don't think it does mean that but I am also not sure what it is. If I have any bright ideas I'll let you know
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question