How to lock entry

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kreso

    #1

    How to lock entry

    I have a database with few connected tables, and I have a true/false
    checkbox in one table.


    Is it possible to lock that row when checkbox iz turned on "true" so the
    data only in that row cannot be edited?

    Thanks


  • Allen Browne

    #2
    Re: How to lock entry

    If you use a form, you can prevent the records from being edited if the
    IsLocked field is Yes, by putting code like this into the Current event
    procedure of your form:

    Private Sub Form_Current()
    Dim bLock as Boolean
    bLock = Nz(Me.IsLocked, False)
    If Me.AllowEdits = bLock Then
    Me.AllowEdits = Not bLock
    End If
    End Sub

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Kreso" <vidovick@gmail .com> wrote in message
    news:e7b8ao$26j $1@ss408.t-com.hr...[color=blue]
    >I have a database with few connected tables, and I have a true/false
    >checkbox in one table.
    >
    >
    > Is it possible to lock that row when checkbox iz turned on "true" so the
    > data only in that row cannot be edited?
    >
    > Thanks[/color]


    Comment

    • Kreso

      #3
      Re: How to lock entry

      Thank you very much, it works!

      "Allen Browne" <AllenBrowne@Se eSig.Invalid> wrote in message
      news:4499267b$0 $12255$5a62ac22 @per-qv1-newsreader-01.iinet.net.au ...[color=blue]
      > If you use a form, you can prevent the records from being edited if the
      > IsLocked field is Yes, by putting code like this into the Current event
      > procedure of your form:
      >
      > Private Sub Form_Current()
      > Dim bLock as Boolean
      > bLock = Nz(Me.IsLocked, False)
      > If Me.AllowEdits = bLock Then
      > Me.AllowEdits = Not bLock
      > End If
      > End Sub
      >
      > --
      > Allen Browne - Microsoft MVP. Perth, Western Australia.
      > Tips for Access users - http://allenbrowne.com/tips.html
      > Reply to group, rather than allenbrowne at mvps dot org.
      >
      > "Kreso" <vidovick@gmail .com> wrote in message
      > news:e7b8ao$26j $1@ss408.t-com.hr...[color=green]
      >>I have a database with few connected tables, and I have a true/false
      >>checkbox in one table.
      >>
      >>
      >> Is it possible to lock that row when checkbox iz turned on "true" so the
      >> data only in that row cannot be edited?
      >>
      >> Thanks[/color]
      >
      >[/color]


      Comment

      Working...