By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,221 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,221 IT Pros & Developers. It's quick & easy.

How to close and open a column in a sub form

P: n/a
Dear reader,

You can close a column (makes a column invisible) in a sub form with the
following VBA code:

SubFormName.Form!FieldName.ColumnWidth = 0

If column is closed and it is necessary to open the column again you expect
the following VBA code will do that:

SubFormName.Form!FieldName.ColumnWidth = 10

But this code gives not an error message and neither has it opened the
column.
Is there a code available which open the column in a sub form after it is
closed by the first code line?

Thanks for any help.

Regards,

Simon
Oct 1 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Simon van Beek wrote:
Dear reader,

You can close a column (makes a column invisible) in a sub form with the
following VBA code:

SubFormName.Form!FieldName.ColumnWidth = 0

If column is closed and it is necessary to open the column again you expect
the following VBA code will do that:

SubFormName.Form!FieldName.ColumnWidth = 10

But this code gives not an error message and neither has it opened the
column.
Is there a code available which open the column in a sub form after it is
closed by the first code line?

Thanks for any help.

Regards,

Simon
This might get you started. I dropped a datasheet into a form. MF =
Mainform. SF = Subform.

Private Sub HideCol_Click()
Forms!MF!SF!FldName.ColumnHidden = -1
End Sub
Private Sub UnHideCol_Click()
Forms!MF!SF!FldName.ColumnHidden = 0
End Sub

Oct 1 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.