changing the proparty of a sub form

  • Thread starter Thread starter Shadow
  • Start date Start date
S

Shadow

How can I change the AllowAdditon proparty of a sub form from its parent
form?

In the OnClick event of a button in a main form, I'm trying to change some
proparty of its subform. Access displays "The method can't be found" error
for the following code.

Me.frmSubStockInOut.AllowAdditions = True


Any kind of help is much appreciated.
 
You're close; you left out the .Form portion of the syntax:

Me.frmSubStockInOut.Form.AllowAdditions = True

Note that the above code assumes that "frmSubStockInOut" is the name of the
subform control (the control on the main/parent form that actually is
holding the subform) and not the name of the form that is the subform.
 
Hi Ken Snell,
I just don't know how to appreciate your quick help. Now I know a little bit
more than half an hour ago. Thanks a lot my friend.

I hope you don't mind if I ask another question.

When I want to refer to the main form from a sub form, I normally use
"Parent". for example:

parent!txtStock.SetFocus

Is there any way to refer to a sub form without using its name? For example
something like:

Child!txtQuantity=20

I appreciate any kind of help.
 
No, there is no corresponding reference to Parent for a subform. You can
have multiple children, but only one parent! You must use the name of the
subform control that holds the subform.
 
Back
Top