This one is annoying me now.
I am trying to work out hiding a column on the opening of a new form but cant seem to get the VBA side working the way i need it to. The scenario is:
I have one form open (in datasheet view), within one of the fields (field2) on this field i have an ON ENTER event set to open a second form (this form is based on a query that uses a field from the initial form as its filter. So when i Click on field 2 it filters form 2 based on the data in field 1). The second form opens is Singleform view. I can get the second form to open and filter the way i want to but i also want to hide specific fields.
At present this is the code im using
DoCmd.OpenForm "Form2", acNormal, , , acFormEdit, acWindowNormal
DoCmd.Requery
Forms!Form2!Field2.ColumnHidden = True
DoCmd.SelectObject acForm, "Form1"
the requery is required so when i move to a new line it updates the filter and the select object is to reselect form1 after all the other actions are complete.
I have also tried doing it with the column.visable = true/ false code but this doesnt hide the field.
Any help is appreciated on this.
I am trying to work out hiding a column on the opening of a new form but cant seem to get the VBA side working the way i need it to. The scenario is:
I have one form open (in datasheet view), within one of the fields (field2) on this field i have an ON ENTER event set to open a second form (this form is based on a query that uses a field from the initial form as its filter. So when i Click on field 2 it filters form 2 based on the data in field 1). The second form opens is Singleform view. I can get the second form to open and filter the way i want to but i also want to hide specific fields.
At present this is the code im using
DoCmd.OpenForm "Form2", acNormal, , , acFormEdit, acWindowNormal
DoCmd.Requery
Forms!Form2!Field2.ColumnHidden = True
DoCmd.SelectObject acForm, "Form1"
the requery is required so when i move to a new line it updates the filter and the select object is to reselect form1 after all the other actions are complete.
I have also tried doing it with the column.visable = true/ false code but this doesnt hide the field.
Any help is appreciated on this.