How to close and open a column in a sub form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Simon van Beek

    #1

    How to close and open a column in a sub form

    Dear reader,



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



    SubFormName.For m!FieldName.Col umnWidth = 0



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



    SubFormName.For m!FieldName.Col umnWidth = 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


  • Salad

    #2
    Re: How to close and open a column in a sub form

    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.For m!FieldName.Col umnWidth = 0
    >
    >
    >
    If column is closed and it is necessary to open the column again you expect
    the following VBA code will do that:
    >
    >
    >
    SubFormName.For m!FieldName.Col umnWidth = 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!Fld Name.ColumnHidd en = -1
    End Sub
    Private Sub UnHideCol_Click ()
    Forms!MF!SF!Fld Name.ColumnHidd en = 0
    End Sub

    Comment

    Working...