From: briank on
I would like to set code in a form that does not allow a user to delete an
entry but at the same time allows them the ability to change it. Currently my
code does not differenciate between the two and will not allow changes. Any
thoughts on how to tweak this?

If IsNull(Me.Grant2_Goal) = False Or _
IsNull(Me.Grant2_Q1) = False Or _
IsNull(Me.Grant2_Q2) = False Or _
IsNull(Me.Grant2_Q3) = False Or _
IsNull(Grant2_Q4) = False Then
MsgBox "<message>", vbOKOnly
Me.Grant2_Notes.Undo
Cancel = True
End If
From: PieterLinden via AccessMonster.com on
briank wrote:
>I would like to set code in a form that does not allow a user to delete an
>entry but at the same time allows them the ability to change it. Currently my
>code does not differenciate between the two and will not allow changes. Any
>thoughts on how to tweak this?
>
>If IsNull(Me.Grant2_Goal) = False Or _
> IsNull(Me.Grant2_Q1) = False Or _
> IsNull(Me.Grant2_Q2) = False Or _
> IsNull(Me.Grant2_Q3) = False Or _
> IsNull(Grant2_Q4) = False Then
> MsgBox "<message>", vbOKOnly
> Me.Grant2_Notes.Undo
> Cancel = True
>End If

Set the form's AllowDeletions property to False and the AllowEdits to True
and I assume AllowAdditions to True.

Probably the easiest way is to use the OnCurrent event.
Me.AllowEdits = Not IsNull(Me.Grant2_Goal) Or <condition2>

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1

From: briank on
Thanks for the response. Unfortunately this example is a subform and thus
missing the On Current EP (my apologies for not not including this bit of
information earlier). Do you have any thoughts on how I can solve this?

"PieterLinden via AccessMonster.com" wrote:

> briank wrote:
> >I would like to set code in a form that does not allow a user to delete an
> >entry but at the same time allows them the ability to change it. Currently my
> >code does not differenciate between the two and will not allow changes. Any
> >thoughts on how to tweak this?
> >
> >If IsNull(Me.Grant2_Goal) = False Or _
> > IsNull(Me.Grant2_Q1) = False Or _
> > IsNull(Me.Grant2_Q2) = False Or _
> > IsNull(Me.Grant2_Q3) = False Or _
> > IsNull(Grant2_Q4) = False Then
> > MsgBox "<message>", vbOKOnly
> > Me.Grant2_Notes.Undo
> > Cancel = True
> >End If
>
> Set the form's AllowDeletions property to False and the AllowEdits to True
> and I assume AllowAdditions to True.
>
> Probably the easiest way is to use the OnCurrent event.
> Me.AllowEdits = Not IsNull(Me.Grant2_Goal) Or <condition2>
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1
>
> .
>
From: John W. Vinson on
On Wed, 5 May 2010 14:35:01 -0700, briank <briank(a)discussions.microsoft.com>
wrote:

>Thanks for the response. Unfortunately this example is a subform and thus
>missing the On Current EP (my apologies for not not including this bit of
>information earlier). Do you have any thoughts on how I can solve this?

Um?

A subform is a form, and it does indeed have an On Current event. Be sure
you're looking at the form's properties (click on the little square at the
upper left intersection of the subform rulers), not those of the Subform
Control (the box containing the subform).
--

John W. Vinson [MVP]
From: briank on
Thanks for the correction John.

"John W. Vinson" wrote:

> On Wed, 5 May 2010 14:35:01 -0700, briank <briank(a)discussions.microsoft.com>
> wrote:
>
> >Thanks for the response. Unfortunately this example is a subform and thus
> >missing the On Current EP (my apologies for not not including this bit of
> >information earlier). Do you have any thoughts on how I can solve this?
>
> Um?
>
> A subform is a form, and it does indeed have an On Current event. Be sure
> you're looking at the form's properties (click on the little square at the
> upper left intersection of the subform rulers), not those of the Subform
> Control (the box containing the subform).
> --
>
> John W. Vinson [MVP]
> .
>