Re: Delete
- From: "John" <johnlee2509@xxxxxxxxxxxxxxx>
- Date: Wed, 18 Jan 2006 13:00:01 -0000
Thanks Again Allen
Regards
John
"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
news:OnZkqzCHGHA.2472@xxxxxxxxxxxxxxxxxxxxxxx
> There could be several reasons why Access can't delete now.
>
> Examples:
> a) The form is unbound.
>
> b) The form is at a new record, where there is nothing to delete.
>
> c) There is an entry in progress that cannot be saved (e.g. required field
> missing), and so the delete cannot occur.
>
> d) The form's AllowDeletions property is No, or the user does not have
> permission to delete.
>
> e) The focus is in a text box where the user has entered something
> invalid, such as 1/16/ in a date field, or "two" in a number field, or
> backspaced out characters in a required field. Access won't let them out
> of the box until they fix the entry or press <esc> to undo it.
>
> f) The event you are using is unsuitable.
>
> This solves some of the problems above (b and c):
>
> Private Sub cmdDelete_Click()
> If Me.Dirty Then
> Me.Undo
> End If
> If Not Me.NewRecord Then
> DoCmd.SetWarnings False
> RunCommand acCmdDeleteRecord
> DoCmd.SetWarnings True
> End If
> End Sub
>
> Other options for deletion without confirmation include using the
> BeforeDelConfirm event of the the form to suppress the confirmation.
>
> Or you can delete from the RecordsetClone of the form:
>
> If Me.Dirty Then
> Me.Undo
> End If
> If Not Me.NewRecord Then
> With Me.RecordsetClone
> .Bookmark = Me.Bookmark
> .Delete
> End With
> End If
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "John" <johnlee2509@xxxxxxxxxxxxxxx> wrote in message
> news:OLykhPCHGHA.1396@xxxxxxxxxxxxxxxxxxxxxxx
>> Hi,
>> Using the "DoCmd.RunCommand acCmdDeleteRecord" statement, how do I set
>> this to works silently?
>> I have set the SetWarnings to False but I get an error message saying
>> "cannot delete now" or words to that effect.
>> If I comment out the SetWarnings Statement the record is deleted but I am
>> prompted which I want to avoid.
>>
>> Regards
>>
>> John
>
>
.
- References:
- Delete
- From: John
- Re: Delete
- From: Allen Browne
- Delete
- Prev by Date: Re: Delete
- Next by Date: Applicationm with 3 backend-databases
- Previous by thread: Re: Delete
- Next by thread: Applicationm with 3 backend-databases
- Index(es):
Relevant Pages
|