Sub form expression

  • Thread starter Thread starter DZ
  • Start date Start date
D

DZ

Hi

i need to use a variable in the following expression that refers to a
subform. I want to replace city (this is field) with as string variable that
is the name of the field. Can anyone rewrite this expression to allow me to
use a string variable strFieldName in place of City

Me.Controls("SubForm1").Form.City.ColumnHidden = True

Thank you
 
I forgot to mention if it isn't obvious. I want use a string variable to
replace the field name , City, in a DATASHEET Subform in the following
expression

Me.Controls("SubForm1").Form.City.ColumnHidden = True
 
Thanks Yes it works because the control name is the same as the field name
.....but how would this be done if the they were different

In other words is there a way to reference the field itself with a variable
or should i not worry about that and just refer to the control?

Thanks alot
 
I don't understand the question.

ColumnHidden applies to controls, not to fields. If you have a field that is
not represented by any control on the form, it is not shown. There is
nothing to set the ColumnHidden property of.

Either that, or I have not understood what you mean.
 
Allen


Your last post
"ColumnHidden applies to controls, not to fields. If you have a field that is
not represented by any control on the form, it is not shown. There is
nothing to set the ColumnHidden property of."

Thanks for pointing that out. I just checked the MSDN topic on ColumnHidden.
There is says that the ColumnHidden property applies to fields in Datasheet
View (tables ?) and controls in Form datasheet view. I understand why I was
confused.

From MSDN:
"The ColumnHidden property applies to all fields in Datasheet view and to
form controls when the form is in Datasheet view."

Thanks you
 
Back
Top