Re: delete warning
- From: Grimwadec <Grimwadec@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 7 Oct 2009 14:54:01 -0700
Yep, in fact my deletejobrecords sub routine was restoring the warnings
before the delete notwithstanding that I had Docmd.SetWarnings True at the
end of the delete statements. So what I did was create a separate function
(SetWarningsTrue) to run after the subroutine and it works perfectly..Thanks
muchly!
--
Grimwadec
"GB" wrote:
My uneducated guess? Assuming that the Form_Delete event function is the.
correct event for what you are doing.
Set Cancel = true prior to leaving the function irregardless of actually
cancelling or not, and then program all that is necessary to delete the
record(s) in question. My guess is that the Form_Delete event is being run
just prior to actually doing the deletion event and therefore resetting the
warnings to true prior to leaving the function activates them on screen when
the deletion actually occurs.
Otherwise, try to restore system warnings at a point later like on the press
of a "required" button or closing the form, or some other follow-on event to
the form_delete event.
The next thing of course is to look into your deletejobrecords sub routine
to see if it restores the warnings before actually doing the delete. :\
"Grimwadec" wrote:
Thanks Tom
As far as I can see (and tested ) SetOption will merely remove the warning
if you run a Delete query. I have already suppressed the delete query
warnings using DoCmd.SetWarnings. Its the system warning produced
after>Highlighting the Record Selector> and clicking Delete (you will note
the original Sub is Form_Delete).
Overall what I am trying to do is when a User deletes a record by
Highlighting the Record Selector on the Form and Clicking Delete on the
keyboard, the only message they get is mine saying, "Subsidiary Record
Details will also be deleted", OK or Cancel.
--
Grimwadec
"Tom van Stiphout" wrote:
On Tue, 6 Oct 2009 20:45:01 -0700, Grimwadec
<Grimwadec@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Check out the SetOption method in the Help file.
-Tom.
Microsoft Access MVP
I have created a function called DeleteJobRecords to delete subsidiary
records when deleting the main record thus:
Private Sub Form_Delete(Cancel As Integer)
DoCmd.SetWarnings False
If MsgBox("Subsidiary Record Details will also be deleted", _
vbOKCancel) = vbCancel Then
Cancel = True
Else: DeleteJobRecords
End If
DoCmd.SetWarnings True
End Sub
I have coded the DeleteJobRecords function to not display any warning as it
runs each SQL delete query. However I have been unable to stop the built in
access warning re deleting the main record. My attempts included the
DoCmd.SetWarnings statements in the above Sub. Also tried several other
methods including Before and After Delete etc.etc. ad nauseum.
Help please!
- Follow-Ups:
- Re: delete warning
- From: GB
- Re: delete warning
- References:
- delete warning
- From: Grimwadec
- Re: delete warning
- From: Tom van Stiphout
- Re: delete warning
- From: Grimwadec
- Re: delete warning
- From: GB
- delete warning
- Prev by Date: Update combobox based on system date
- Next by Date: RE: Update combobox based on system date
- Previous by thread: Re: delete warning
- Next by thread: Re: delete warning
- Index(es):