Solved

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

Posted on 2001-06-06
5
196 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

789 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