controlling a control on a subform 
Author Message
 controlling a control on a subform

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.

Thanks!

--
Bill

PhotoSourceFolio webmaster
http://www.*-*-*.com/



Sun, 27 Oct 2002 03:00:00 GMT  
 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.

Quote:

> 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


Mon, 28 Oct 2002 03:00:00 GMT  
 controlling a control on a subform

Quote:

> 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



Mon, 28 Oct 2002 03:00:00 GMT  
 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.



Mon, 28 Oct 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Control name of subform from code behind subform

2. strange focus/control prob on subform

3. How to Requery a control on a subform

4. Filter Querry on Subform using calender control

5. Set control to subform and allow edits

6. move data from unbound boxes to subform controls

7. Class to control subform behavior - worth it?

8. Form/Subform Controls and Events

9. Using a main form to control the edit properties of a subform using VBA

10. subform control

11. OnCurrent Event for Subform on Tab Control

12. How do I disable (and dim) subform controls

 

 
Powered by phpBB® Forum Software