Solved

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

Posted on 2001-06-06
5
200 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
[X]
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
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

623 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