I currently have a form that is locked to prevent accidental editing. However, the form contains information such as customer contact information that might need to be edited. I currently have a command button that users can click that closes the form and reopens it in "edit" mode. What I would like to happen is to have all other command buttons on the page disappear when the form reloads and a "save" button appear. Once the save button is clicked I want the form to go back to non-editable and all the command buttons to reappear.
I currently have something similar set up on another form in the database (see code below) but that is for adding a new record. How do I set it up for an existing record? Is there a more elegant way to do it besides closing and reopening the form? I've searched for quite a while and can't seem to find anything to this end. Please let me know if you need more background information about how the database is structured or more specifics with what I am trying to do. Thank you for your help!
*
Private Sub add_Click()
On Error Resume Next
DoCmd.GoToRecord , , acNewRec
End Sub
Private Sub Form_Current()
If Me.NewRecord Then
Me.recordcounter.Caption = "New Record"
Me.next.Visible = False
Me.previous.Visible = False
Me.first.Visible = False
Me.last.Visible = False
Me.add.Visible = False
Me.save.Visible = True
Else
Me.recordcounter.Caption = "Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount
Me.next.Visible = True
Me.previous.Visible = True
Me.first.Visible = True
Me.last.Visible = True
Me.add.Visible = True
Me.save.Visible = False
End If
End Sub
Private Sub save_Click()
DoCmd.save
Me.previous.Visible = True
Me.first.Visible = True
Me.recordcounter.Caption = "Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount + 1
Me.previous.SetFocus
Me.save.Visible = False
End Sub
*