
controlling a control on a subform
Very interesting.
My practice and recommendation is to put the enabling / disabling code in a
Public Sub of frmSub. This allows frmMain to call the code and allows you
to test the code in the subform alone. Also good if the subform gets used
in multiple contexts.
Within frmMain:
If condition Then
Call Me.subform.Form.FunkySub(arg1,arg2,arg3)
End If
Within frmSub:
Public Sub FunkySub(bEdits as boolean, bDeletions as boolean, bAdditions as
boolean)
Me.AllowEdits = bEdits
Me.AllowDeletions = bDeletions
Me.AllowAdditions = bAdditions
End Sub
Have fun,
Kevin
Quote:
----- Original Message -----
Newsgroups: microsoft.public.access.modulesdaovba
Sent: Thursday, May 11, 2000 8:36 AM
Subject: Re: controlling a control on a subform
> > In the AfterUpdate event procedure of Form1, change the
> > Enabled property of the subform control on Form1.
> > You'll need to be careful of anthing that might
> > programatically dirty sub1. The user can't move back to
> > the main form without triggering a save of the subform,
> > so the sub could only be dirty programatically.
> > > How do I control the value of a control on a subform?
> > > For instance, sub1 is on form1 linked via PriKey fields. Depending on
the
> > > status of a variable (set due to some action taken with form1's data),
I
> > > want to either enable or disable data edits and deletions on the
subform
> > > sub1 while on form1.
> > --
> > Perth, Western Australia
> > Tips for MS Access users at:
> > http://odyssey.apana.org.au/~abrowne
> If understand the situation correctly ...
> Setting the enabled property of the subform control to False would
disallow
> movement within the subform. For exampke if it were a continuous form
> displaying a list of records, the scrollbar would be disabled.
> Wouldn't it be better to to change the AllowEdits, AllowDeletions and
> AllowAdditions properties instead. This would also give more precise
control
> over how the subforms data can be manipulated.
> e.g.
> Forms!Form1!sub1.Form.AllowEdits = False
> Forms!Form1!sub1.Form.AllowDeletions = False
> Forms!Form1!sub1.Form.AllowAdditions = False
> Regards,
> --
> Roger E K Stout
> Programmer
> Database Development
> Marconi Software Solutions Ltd.
> Tel 01785 782339
> Fax 01785 244397
> > In the AfterUpdate event procedure of Form1, change the
> > Enabled property of the subform control on Form1.
> > You'll need to be careful of anthing that might
> > programatically dirty sub1. The user can't move back to
> > the main form without triggering a save of the subform,
> > so the sub could only be dirty programatically.