Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

919 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now