G
Guest
Hi there
I have forms which require users to click a button to be able to edit records. The records are not able to be modified unless the user clicks into edit mode
Problem: I have to use lengthy code to do this. Is there a faster, more efficient way to do this
This is the code is use
Private Sub cmdEditRecords_Click(
On Error GoTo Err_cmdEditRecords_Clic
On Error GoTo Err_cmdEditRecords_Clic
Me.Refres
If cmdEditRecords.Caption = "READ ONLY!" The
Me.AllowAdditions = Tru
Me.AllowDeletions = Tru
Me.AllowEdits = Tru
DoCmd.GoToRecord , , acNewRe
Me.TestLocation.SetFocu
Forms![frmTest]![sfrmTestReading].Form.AllowEdits = Tru
Forms![frmTest]![sfrmTestReading].Form.AllowDeletions = Tru
Forms![frmTest]![sfrmTestReading].Form.AllowAdditions = Tru
Me.cmdNewTree.Enabled = Tru
cmdEditRecords.Caption = "EDIT MODE!
cmdEditRecords.ForeColor = 25
Els
cmdEditRecords.Caption = "READ ONLY!
cmdEditRecords.ForeColor = 1671168
Me.AllowAdditions = Fals
Me.AllowDeletions = Fals
Me.AllowEdits = Fals
Forms![frmTest]![sfrmTestReading].Form.AllowEdits = Fals
Forms![frmTest]![sfrmTestReading].Form.AllowDeletions = Fals
Forms![frmTest]![sfrmTestReading].Form.AllowAdditions = Fals
Me.cmdNewTree.Enabled = Fals
End I
Me.Refres
Exit_cmdEditRecords_Click
Exit Su
Err_cmdEditRecords_Click
If Err.Number = 3314 The
MsgBox "Before you can exit this screen or edit mode, the following fields must contain data: Test Location, Test Date, Indicator Test, Shipment, Variety, Propagatin, Location and Row."
& Chr(13) & Chr(13) & "Make sure all required fields have values."
& Chr(13) & Chr(13) & "To clear the values you have entered, press ESCAPE.
End I
End Su
Regards
Carlee
I have forms which require users to click a button to be able to edit records. The records are not able to be modified unless the user clicks into edit mode
Problem: I have to use lengthy code to do this. Is there a faster, more efficient way to do this
This is the code is use
Private Sub cmdEditRecords_Click(
On Error GoTo Err_cmdEditRecords_Clic
On Error GoTo Err_cmdEditRecords_Clic
Me.Refres
If cmdEditRecords.Caption = "READ ONLY!" The
Me.AllowAdditions = Tru
Me.AllowDeletions = Tru
Me.AllowEdits = Tru
DoCmd.GoToRecord , , acNewRe
Me.TestLocation.SetFocu
Forms![frmTest]![sfrmTestReading].Form.AllowEdits = Tru
Forms![frmTest]![sfrmTestReading].Form.AllowDeletions = Tru
Forms![frmTest]![sfrmTestReading].Form.AllowAdditions = Tru
Me.cmdNewTree.Enabled = Tru
cmdEditRecords.Caption = "EDIT MODE!
cmdEditRecords.ForeColor = 25
Els
cmdEditRecords.Caption = "READ ONLY!
cmdEditRecords.ForeColor = 1671168
Me.AllowAdditions = Fals
Me.AllowDeletions = Fals
Me.AllowEdits = Fals
Forms![frmTest]![sfrmTestReading].Form.AllowEdits = Fals
Forms![frmTest]![sfrmTestReading].Form.AllowDeletions = Fals
Forms![frmTest]![sfrmTestReading].Form.AllowAdditions = Fals
Me.cmdNewTree.Enabled = Fals
End I
Me.Refres
Exit_cmdEditRecords_Click
Exit Su
Err_cmdEditRecords_Click
If Err.Number = 3314 The
MsgBox "Before you can exit this screen or edit mode, the following fields must contain data: Test Location, Test Date, Indicator Test, Shipment, Variety, Propagatin, Location and Row."
& Chr(13) & Chr(13) & "Make sure all required fields have values."
& Chr(13) & Chr(13) & "To clear the values you have entered, press ESCAPE.
End I
End Su
Regards
Carlee