Re: prevent deletion of record
- From: "George Nicholson" <JunkGeorgeN@xxxxxxx>
- Date: Tue, 23 Aug 2005 15:10:43 -0500
There are *several* ways to delete a record (Edit>DeleteRecord, Ctrl +
KeypadMinusKey, etc.). Disabling the command button only covers one of them.
Granted, coding the Delete event only works while in Form view, but it
covers all the possibilites while in Form view.
Having the command button disabled might be less confusing for the user, but
that's only cosmetic unless you've turned off menus and are trapping
keystrokes. To protect the data while in Form view you need to code the
Delete event (or set the Form to not allow deletions).
HTH,
--
George Nicholson
Remove 'Junk' from return address.
"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A9918C14-E2D6-4062-B2AA-AC1543CF7E95@xxxxxxxxxxxxxxxx
> George's method will work, but to disable the command button, my original
> suggestion would be the way to go.
> Yes, you can have as many lines as you need in any event.
>
> "Sue" wrote:
>
>> thanks, this seems to do what i need. Wish i knew VB!
>>
>> "George Nicholson" wrote:
>>
>> > Forms have a Delete event, which can be cancelled. Here is a
>> > modification of
>> > the example in VBA Help that might work for you:
>> >
>> > Private Sub Form_Delete(Cancel As Integer)
>> > If Me.PreviousYear <> 0 Then
>> > Cancel = True
>> > MsgBox "This record can't be deleted."
>> > End If
>> > End Sub
>> >
>> > Forms also have BeforeDelConfirm & AfterDelConfirm events, but those
>> > only
>> > fire if you have Tools>Options>Edit>ConfirmRecordChanges turned On,
>> > which is
>> > frequently not the case.
>> >
>> > HTH,
>> > --
>> > George Nicholson
>> >
>> > Remove 'Junk' from return address.
>> >
>> >
>> > "Sue" <Sue@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> > news:7E40350F-5E90-4496-BF6F-74365535F410@xxxxxxxxxxxxxxxx
>> > >I have a form that displays previous year's info at top w/ space to
>> > >enter
>> > >new
>> > > info current year info at bottom. I would like to prevent the
>> > > deletion
>> > > of
>> > > the record if there is a value greater than '0' in the previous yr
>> > > value.
>> > > There is a deletion button on the form.
>> > >
>> > > Suggestions...
>> >
>> >
>> >
.
- References:
- prevent deletion of record
- From: Sue
- Re: prevent deletion of record
- From: George Nicholson
- Re: prevent deletion of record
- From: Sue
- Re: prevent deletion of record
- From: Klatuu
- prevent deletion of record
- Prev by Date: Re: Email Cmd
- Next by Date: Re: Not sure I can do this.
- Previous by thread: Re: prevent deletion of record
- Next by thread: Email Cmd
- Index(es):