block edit and delete record in form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • barkarlo
    New Member
    • Nov 2006
    • 59

    block edit and delete record in form

    I use check box in a form "frmworkord er" like confirmation that's record finish.
    How can I write code who will block edit and delete record in form when is check box confirmed.
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by barkarlo
    I use check box in a form "frmworkord er" like confirmation that's record finish.
    How can I write code who will block edit and delete record in form when is check box confirmed.
    Code:
    Private Sub Form_Current()
    If Me!YourCheckbox.Value = True Then
           Me.AllowEdits = False
           Me.AllowDeletions = False
    Else
           Me.AllowEdits = True
           Me.AllowDeletions = True
    End If

    Comment

    • barkarlo
      New Member
      • Nov 2006
      • 59

      #3
      Originally posted by puppydogbuddy
      Code:
      Private Sub Form_Current()
      If Me!YourCheckbox.Value = True Then
             Me.AllowEdits = False
             Me.AllowDeletions = False
      Else
             Me.AllowEdits = True
             Me.AllowDeletions = True
      End If
      I have one quick search control in form and when i put this code in form
      quick searck not work. What can I do that quick search work.

      Comment

      • Minion
        Recognized Expert New Member
        • Dec 2007
        • 108

        #4
        Could you include more information on the quick search and what about it is not working, such as an error message or better yet the code that is causing the problems. Without further information there is not much that we can tell you.

        - Minion -

        Originally posted by barkarlo
        I have one quick search control in form and when i put this code in form
        quick searck not work. What can I do that quick search work.

        Comment

        • puppydogbuddy
          Recognized Expert Top Contributor
          • May 2007
          • 1923

          #5
          Originally posted by barkarlo
          I have one quick search control in form and when i put this code in form
          quick searck not work. What can I do that quick search work.

          Ok, since you did not mention the search control exception, the code I gave you blocks edits and deletes for the entire form. You might be able to get around it by adding the following code. If this additional code does not do the trick, then we need code that loops thru each control on the form. Give this additional code a try and let us know what happens.
          Code:
          Private Sub YourSearchControl_Enter()
            Me.AllowEdits = True
          End Sub
          
          Private Sub YourSearchControl_Exit()
               If Me.YourCheckbox.Value = True
                      Me.AllowEdits = False
               Else 
                      Me.AllowEdits = True
               End If
          End Sub

          Comment

          Working...