Coding property of the controls on subform

  • Thread starter Thread starter Ceici
  • Start date Start date
C

Ceici

I created a form that has two subforms on it. Let me
call main form A and first subform is B and C is third
subform.
Form A and B link together by using same Primary key
EmployeeID as one-to-many.
Form B and C link together by using same Primary key
InjuryID as one-to-many.

On form B I created a Edit button to be able to turn
locked property of all controls (drop down, textbox
etc..) on the form "on and off" , but I would also be
able to control the property of the control on form C
which is a subform on form B.

My question is " Is there anyway that I can control them?
If I can, what the code of that?

I can only change the property of the C form, but
couldn't change the property of control on C form :

With Me
..tblInjuryRecordSubform.Form.AllowAdditions = True
..tbl
End With

Thank you,
Ceici
 
Have you tried something like

Me.tblInjuryRecordSubform.Form.Control1_Name.Locked = False
Me.tblInjuryRecordSubform.Form.Control2_Name.Locked = False

You could also refer to controls using the Controls collection of the
Form object, which you address liek this:

Me.Subform.Form.Controls("ControlName").Property = Value

Hope this helps,
Pavel
 
Pavel,
I tried the first way
(Me.tblInjuryRecordSubform.Form.Control1_Name.Locked =
False), but it didn't work. So, I tried the second way
and It works very well.
Could you tell me what difference from these two code.

Thank you so much,
Ceici
 
I suppose you are talking about setting .Locked property vs. setting a
generic property? I am guessing, the way you are disabling the controls
is not using the (Control).Locked property, so the first way didn't
work. In the second way, you've changed the parameter(s) you *are* using
- so it worked.
I am assuming you have renamed Control1_Name to the real control names
on the form when you tried to change .Locked parameter.
Good luck,
Pavel
 
Back
Top