A personal repository of random information in compensation for a fatigued biological computer
Breaded IT » MS Access / SQL Server reminders » Access: Form Standard Edit Button
On form:
Private Sub btnEdit_Click()
Me.AllowEdits = True
Call FormatFieldForEdit("frmBenchMarks", "bmValue")
End Sub
In Main:
Sub FormatFieldForView(targetform As String, targetcontrol As String)
Forms(targetform).Controls(targetcontrol).Enabled = False
Forms(targetform).Controls(targetcontrol).Locked = True
Forms(targetform).Controls(targetcontrol).SpecialEffect = 0 ' flat
Forms(targetform).Controls(targetcontrol).BackStyle = 1 ' Normal
Forms(targetform).Controls(targetcontrol).BackColor = 15660020
Forms(targetform).Controls(targetcontrol).BorderStyle = 1
Forms(targetform).Controls(targetcontrol).BorderColor = 8421504
End Sub
Sub FormatFieldForEdit(targetform As String, targetcontrol As String)
Forms(targetform).Controls(targetcontrol).Enabled = True
Forms(targetform).Controls(targetcontrol).Locked = False
Forms(targetform).Controls(targetcontrol).SpecialEffect = 2 ' Sunken
Forms(targetform).Controls(targetcontrol).BackStyle = 1 ' Normal
Forms(targetform).Controls(targetcontrol).BackColor = 16777215
Forms(targetform).Controls(targetcontrol).BorderStyle = 1
End Sub