Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Southern CA
    Posts
    8

    Question Unanswered: Edit Record button

    I want to lock a form from being able to be updated or changed and have a button which is called "Edit Record" which will unlock the record and allow edits, then a button called "Save Record" which will lock the from back up again for viewing only. I have seen these buttons in other databases, but I m not sure how to create them (and what my form controls should be set to). Please help!

  2. #2
    Join Date
    Dec 2002
    Location
    United States
    Posts
    2
    Here is what I use in a form with a command button called Edit/lookup Employers records. The following is the code for that command button.

    Private Sub Edit___Lookup_Employers_Click()
    On Error GoTo Err_Edit___Lookup_Employers_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Employers"

    stLinkCriteria = "[Employer]=" & "'" & Me![Employer Name] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_Edit___Lookup_Employers_Click:
    Exit Sub

    Err_Edit___Lookup_Employers_Click:
    MsgBox Err.Description
    Resume Exit_Edit___Lookup_Employers_Click

    End Sub

  3. #3
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    and this is how i did it
    Code:
    '------------------------------------------------------------
    ' ReviewData_Click
    '
    '------------------------------------------------------------
    Private Sub ReviewData_Click()
    On Error GoTo ReviewData_Err
        DoCmd.OpenForm "FindAccident", acNormal, "", "", acFormReadOnly, acNormal
        Form_FindAccident.review = acFormReadOnly
        Form_FindAccident.State.Visible = False
    
    
    ReviewData_Exit:
        Exit Sub
    
    ReviewData_Err:
        MsgBox Error$
        Resume ReviewData_Exit
    
    End Sub
    
    
    '------------------------------------------------------------
    ' EditData_Click
    '
    '------------------------------------------------------------
    Private Sub EditData_Click()
    On Error GoTo EditData_Click_Err
        DoCmd.OpenForm "FindAccident", acNormal, "", "", acFormEdit, acNormal
        Form_FindAccident.review = acFormEdit
     
    
    EditData_Click_Exit:
        Exit Sub
    
    EditData_Click_Err:
        MsgBox Error$
        Resume EditData_Click_Exit
    
    End Sub
    i also had a form opening off the other form that i wanted to share it's state
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •