none
Form in Datasheet view - Disallow field placement manipulation RRS feed

  • Question

  • Good day all-

    I have a form in a datasheet view.  It works fine, more or less.  However, I have two concerns with it:
    1) Users can drag columns around and change their order, and
    2) Users can highlight a column, and press delete on their keyboard and delete the column.

    I can set the datasheet as not enabled, but then I lose the ability for users to use the filtering ability on the column headers (ie, the drop downs on the header columns).

    Does anyone know how I might be able to disable the ability to manipulate column placement and the ability to delete a column, while maintaining the ability to filter via the column header dropdowns?

    Thanks!

    Casey

    Thursday, January 28, 2016 1:59 PM

Answers

  • I have a form in a datasheet view.  It works fine, more or less.  However, I have two concerns with it:
    1) Users can drag columns around and change their order, and
    2) Users can highlight a column, and press delete on their keyboard and delete the column.

    Hi Casey,

    For #2, try setting the form's Allow Layout View property to No.

    Hope that helps...

    • Marked as answer by Casey_M Friday, January 29, 2016 3:36 PM
    Thursday, January 28, 2016 3:51 PM
  • Test with the below code.

    Private Sub Form_Load()
    Dim commandBar As Office.commandBar
    Set commandBar = CommandBars.Item("Form Datasheet SubColumn")

    For I = 1 To commandBar.Controls.Count
        Set ctl = commandBar.Controls.Item(I)

        If ctl.Caption = "S&ubform" _
            Or ctl.Caption = "&Delete" _
            Or ctl.Caption = "Add Existing Fie&lds" _
            Or ctl.Caption = "Con&ditional Formatting..." Then
            ctl.Visible = False
        End If

    Next

    End Sub



    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.

    • Marked as answer by Casey_M Friday, January 29, 2016 3:36 PM
    Thursday, January 28, 2016 8:49 PM

All replies

  • A continuous form will do all you need.  Use form design rather than opt for datasheet....the wizard can be used to get the core of it set up quickly...
    • Proposed as answer by André Santo Thursday, January 28, 2016 3:53 PM
    Thursday, January 28, 2016 2:12 PM
  • I have a form in a datasheet view.  It works fine, more or less.  However, I have two concerns with it:
    1) Users can drag columns around and change their order, and
    2) Users can highlight a column, and press delete on their keyboard and delete the column.

    Hi Casey,

    For #2, try setting the form's Allow Layout View property to No.

    Hope that helps...

    • Marked as answer by Casey_M Friday, January 29, 2016 3:36 PM
    Thursday, January 28, 2016 3:51 PM
  • Test with the below code.

    Private Sub Form_Load()
    Dim commandBar As Office.commandBar
    Set commandBar = CommandBars.Item("Form Datasheet SubColumn")

    For I = 1 To commandBar.Controls.Count
        Set ctl = commandBar.Controls.Item(I)

        If ctl.Caption = "S&ubform" _
            Or ctl.Caption = "&Delete" _
            Or ctl.Caption = "Add Existing Fie&lds" _
            Or ctl.Caption = "Con&ditional Formatting..." Then
            ctl.Visible = False
        End If

    Next

    End Sub



    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.

    • Marked as answer by Casey_M Friday, January 29, 2016 3:36 PM
    Thursday, January 28, 2016 8:49 PM