Enable/Disable form row edit.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ggfota
    New Member
    • Aug 2009
    • 6

    Enable/Disable form row edit.

    How make some rows of a Form fully locked for edit based on criteria?

    Let's take two fields Date (criteria), Qty (editable).
    I will list all rows where Date is between DateFROM and DateTO.
    Now I want to be able to edit only fields where Date>DateTO-5.

    Is there property to lock selected rows of displayed data in the Form DataSheet View. I guest I could do it with VBA in Single View but that's not the case.
  • Megalog
    Recognized Expert Contributor
    • Sep 2007
    • 378

    #2
    Since you can only edit the current record, then it doesnt matter if you're in a form, continuous form, or datasheet; the same code applies.

    I would do something like the following: (substitute the <date criteria> section for whatever real criteria you need)

    Code:
    Private Sub Form_Current()
        If <date criteria> = True or Me.NewRecord Then
            Me.AllowEdits = True
        Else
            Me.AllowEdits = False
        End If
    End Sub
    There's cleaner ways to execute this, but this gets the idea across.

    Comment

    Working...