"Conditional" editing of subforms

C

ckrogers

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!
 
A

Allen Browne

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.
 
C

ckrogers

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top