Subforms and Datasheet View

  • Thread starter Thread starter Sjanlaird
  • Start date Start date
S

Sjanlaird

Guest
I wonder if anyone can help me with a small problem.

I've a subform in datasheet view that is to be displayed in a forms in datasheet view. Depending on the parent form, certain fields need to hidden.
How can I use code in the main form to either hide these fields or to set their widths to zero.

Any help would be much appreciated.
 
A trick I used was to make a subform (in the plain form view of wizard) the way I needed it first and then insert in other form as a sub form...
 
Thanks - but what I need to do is have one subform, formatted a number of different ways depending on the parent form using it. I could create many different subforms, but since they are all so similar it seems a bit of a waste.
 
In the OnOpen Event for your form(s), you could use the following property to hide the columns in a datasheet...

Me.FieldName.ColumnHidden = True
or for a subform try..
Forms!MainForm!Subform.Form.FieldName.ColumnHidden = True

or display them...

Me.FieldName.ColumnHidden = False
or for a subform try...
Forms!MainForm!Subform.Form.FieldName.ColumnHidden = False

HTH
 
Last edited:
Bingo!

Many thanks - I guessed it would be fairly straightforward, I just couldn't find the right property.
 

Users who are viewing this thread

Back
Top Bottom