Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2001-06-06
Medium Priority
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
Question by:larkahn
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Accepted Solution

AndrewDev earned 600 total points
ID: 6161648
Take a look at this article

I think it may help

Author Comment

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

Expert Comment

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


Author Comment

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.

Expert Comment

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Suggested Courses

722 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