How to Hidden Column in subform (Subdatasheet)?

radek225

Registered User.
Local time
Yesterday, 16:52
Joined
Apr 4, 2013
Messages
307
In open Mainform event
Forms!Mainform.Form!SubForm!controlname.columnhidden = false doesn't work. Ms Access can't find "subform"

On load and open events in subform doesn't work with columnhidden. (no reaction)
 
Code:
Forms![COLOR="blue"]MainForm[/COLOR]![COLOR="blue"]SubformControlName[/COLOR]![COLOR="blue"]ControlName[/COLOR].ColumnHidden = [COLOR="Red"]True[/COLOR]

Forms![COLOR="blue"]MainForm[/COLOR]![COLOR="blue"]SubformControlName[/COLOR].Form.[COLOR="Blue"]ControlName[/COLOR].ColumnHidden = [COLOR="red"]True[/COLOR]
And it will only work in Datasheet view.
If the subform is in the main form replace "Forms!MainForm!" with "Me."
Make sure you're referring to the control as well, not the field.
 
Both don't work.

AD 1) Ms Access error - Metod or data member not found
On load in main form:
Code:
Me.SubForm!controlname.ColumnHidden = True
AD 2) Ms Access error
On load in main form:
Code:
Me.SubForm.Form.controlname.ColumnHidden = True
 
----------> ---------->
and it will only work in datasheet view.
If the subform is in the main form replace "forms!mainform!" with "me."
make sure you're referring to the control as well, not the field.
 
1) Yes, I have a datasheet view
2) I replaced it
3) I refering it correctly
 
If you are referring to it properly you won't get errors. Look at the correct name of the subform control. Not the name of the subform, but the name of the subform control.

Or do it in the Load event of the subform itself without the subform reference.
 
Ok, now it's fine. You were right about the names of controls
 

Users who are viewing this thread

Back
Top Bottom