I have an access database with a parent form which has a subform in datasheet view. The subform has advanced fields that don’t need to be visible all the time, lets go with one field “productcode” in subform “deliverylines”, parent form is “deliveryheaders”. So i need a button the main form that will make the “productcode” column visible.
This is what I’ve been trying but its just throwing errors at me 🙁
Private Sub showadvanced_Click()
Me.DeliveryLines.Productcode.Visible = True
end sub
In order to hide a column in datasheet view you would need to use code like the following:
Forms(Me.Name)("deliverylines").Form.Controls("productcode").ColumnHidden = TrueThis will set the column hidden property
Note the full syntax to refer to a control on a subform is as follows:
The example code I have supplied presumes that your subform control name is deliverylines