You can manage the native Access delete message without
turning off warnings completely. I use the form's BeforeDelConfirm
event.
'***** code start *****'
Private Sub Form_BeforeDelConfirm(Cancel As Integer,
Response As
Integer)
Response = acDataErrContinue '<-- this turns of the native Access message
Response = acDataErrContinue '<-- this turns of the native Access message
'-- if RI is an issue,
you can/should look for related records and handle
them
If Nz(DCount("PrimaryKeyField", "RelatedTable", "ForeignKeyID=" & Me.PrimaryKeyField), 0) > 0 Then
'-- handle the related records here - you may want to give the user the option to delete them programatically,
'-- or just deny them the delete
End If
If MsgBox("Are you sure you want to delete this record?", vbYesNo, AppName) <> vbYes Then
Cancel = True '<-- this cancels the delete
End If
End Sub
If Nz(DCount("PrimaryKeyField", "RelatedTable", "ForeignKeyID=" & Me.PrimaryKeyField), 0) > 0 Then
'-- handle the related records here - you may want to give the user the option to delete them programatically,
'-- or just deny them the delete
End If
If MsgBox("Are you sure you want to delete this record?", vbYesNo, AppName) <> vbYes Then
Cancel = True '<-- this cancels the delete
End If
End Sub
'***** code end
*****'
Tom Oakes
Personal PC Consultants, Inc.
[EMAIL PROTECTED]
503.230.0911 (O)
402.968.6946 (C)
713.583.7091 (F)
From:
[email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of waveland2050
Sent: Sunday, July 10, 2005 9:56 AM
To: [email protected]
Subject: [AccessDevelopers] selective warning
If Warnings are set to be off, the user can try to delete a
record Sent: Sunday, July 10, 2005 9:56 AM
To: [email protected]
Subject: [AccessDevelopers] selective warning
whose deletion would violate referential integrity, but gets no
message, just that the delete does not happen. But if you turn the
warnings on, first you get that "You are about to delete one
record..." followed by the one about RI. I would like to be able to
generate my own warning, but don't know how to "catch" this error. Is
this possible?
Please zip all files prior to uploading to Files section.
---- LSpots keywords ?>---- HM ADS ?>
Please zip all files prior to uploading to Files section.
---- LSpots keywords ?> ---- HM ADS ?>
YAHOO! GROUPS LINKS
- Visit your group "AccessDevelopers" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
