I have a main form which pulls down data based on the form it was open from.
What I want it to do is to look at a field it has just updated, and
depending on its result, either make AllowEdits = false or true (and a couple
of others).
I used the code:
If [Forms]![Frm UserViewBreach]![Str_Status] = "Rejected" Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = True
CmdSubmit.Enabled = True
Else
Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False
CmdSubmit.Enabled = False
End If
Now it runs through the code but I can can still make changes etc on the form.
What am I missing please?
BeWyched - 07 Feb 2008 15:17 GMT
Hi
This give you the answer/solution:
http://kbalertz.com/167420/Editable-AllowEdits-Property-False.aspx
Cheers.
BW
> I have a main form which pulls down data based on the form it was open from.
>
[quoted text clipped - 23 lines]
>
> What am I missing please?
Maver1ck666 - 07 Feb 2008 15:31 GMT
Thanks for the reply.
Im not sure though how this will work and it doesn't seem applicable to A03.
> Hi
>
[quoted text clipped - 33 lines]
> >
> > What am I missing please?
John Spencer - 07 Feb 2008 19:12 GMT
Try saving the change to the record first.
If [Forms]![Frm UserViewBreach]![Str_Status] = "Rejected" Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = True
CmdSubmit.Enabled = True
Else
If Me.Dirty = True THEN Me.Dirty = False
Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False
CmdSubmit.Enabled = False
End If
I'm not sure that will do it, but I am pretty sure that if the record is
dirty the form's property can't be set so the it is not editable.

Signature
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
.
>I have a main form which pulls down data based on the form it was open
>from.
[quoted text clipped - 26 lines]
>
> What am I missing please?