Making field in subform not visible

G

Guest

Hi,

I am a new user to access. I am working with Access 2003. I have created a
form, which has a subform associated with it. Based on certain situations, I
want to make a field of the subform not visible and disable other fields. On
the load event of the Main form, I have written code to disable a field in
the subform. But I tried the similar approach to make the very disabled
field not visible but I am not able to do so. Here is the code that I have:

With Me!Engagement_Stakeholder_Name_Table_Subform.Form

!Stakeholder_Var.SetFocus
!Stakeholder_Name.Enabled = False
!Stakeholder_Group.Enabled = False
!Stakeholder_Title.Enabled = False
!Stakeholder_Region.Enabled = False
!Stakeholder_Comments.Enabled = False
!Stakeholder_OC_Change_Curve.Enabled = False
!Stakeholder_OC_Change_Curve.Visible = False

For whatever reason, it still shows the Stakeholder_OC_Change_Curve as
visible although it is disabled. I would like for it to be not visible. I
also tried removing the enable = false statment and just keeping the visible
equals false, but that didn't work either. Any ideas why this would be.
Thanks in advance.
 
T

TC

A few things.

1. To set the focus to a control on a subfom, you have to /first/ set
the focus to the subform /control/ on the main form, and /then/ set the
focus to the desired control on the subform. Like: me![sf].setfocus,
then: me![sf].form![blah].setfocus, where 'sf' is the name of the
subform control on the main form, and 'blah' is the name of the control
on the subform. Strange, but true!

2. Disabling a control does not make it invisible. There is a seperate
property, Visible, for that.

3. If you want everything to change accordingly, as you move from
record to record within the main form, you'd put it in the main form's
Current event - not its Load event (which only fires once).

HTH,
TC
 

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