"Conditional" editing of subforms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to set the property of a continuous form subform based on the
value of one field on the main form. If the value of [Submitted Date] is not
NULL, I'd like to allow changes but no adds to the subform on one form (Form
A) and I'd like to not even allow changes on another form (Form B). Could
someone please help me with the coding? Thanks!
 
Use the Current event procedure of the main form to set the AllowEdits and
AllowAdditions properties of the subforms, e.g.:

If Not IsNull(Me.[Submitted Date]) Then
With Me.[Form A].Form
.AllowEdits = True
.AllowAdditions = False
.AllowDeletions = False
End With
Else
...

Then in the AfterUpdate event of the main form, call the same code so it
locks them straight away:
Call Form_Current

Note that when you set AllowAdditions to No and there are no records in the
subform, its Detail section goes completely blank.
 
That worked perfectly! Thanks, Allen!
Cindy

Allen Browne said:
Use the Current event procedure of the main form to set the AllowEdits and
AllowAdditions properties of the subforms, e.g.:

If Not IsNull(Me.[Submitted Date]) Then
With Me.[Form A].Form
.AllowEdits = True
.AllowAdditions = False
.AllowDeletions = False
End With
Else
...

Then in the AfterUpdate event of the main form, call the same code so it
locks them straight away:
Call Form_Current

Note that when you set AllowAdditions to No and there are no records in the
subform, its Detail section goes completely blank.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

ckrogers said:
I would like to set the property of a continuous form subform based on the
value of one field on the main form. If the value of [Submitted Date] is
not
NULL, I'd like to allow changes but no adds to the subform on one form
(Form
A) and I'd like to not even allow changes on another form (Form B). Could
someone please help me with the coding? Thanks!
 
Back
Top