andy_dyer
Registered User.
- Local time
- Today, 17:32
- Joined
- Jul 2, 2003
- Messages
- 806
Hi,
I want to lock down my database to prevent accidental data changes...
I have a command button (cmdEdit) which on click should enable edit to both my main form and sub-form and then on a second click should return the forms to read only...
It works for the subform but not for the main form... initailly it is read only and then with the click I can edit but when i try to disable edits again it still allows me to change things...
What's wrong with my code???
If it helps this is code that launches my main form (frmProject)
I want to lock down my database to prevent accidental data changes...
I have a command button (cmdEdit) which on click should enable edit to both my main form and sub-form and then on a second click should return the forms to read only...
It works for the subform but not for the main form... initailly it is read only and then with the click I can edit but when i try to disable edits again it still allows me to change things...

Code:
Private Sub cmdEdit_Click()
If Me.AllowEdits = True Then
Me.AllowEdits = False
Me.AllowAdditions = False
Me!Invoice.Form.AllowEdits = False
Me!Invoice.Form.AllowAdditions = False
Me.cmdEdit.Caption = "Edit is Disabled"
Else
Me.AllowEdits = True
Me.AllowAdditions = True
Me!Invoice.Form.AllowEdits = True
Me!Invoice.Form.AllowAdditions = True
Me.cmdEdit.Caption = "Edit is Enabled"
End If
End Sub
What's wrong with my code???
If it helps this is code that launches my main form (frmProject)
Code:
Private Sub cmdData_Click()
If Me.cboClient > 0 Or Me.cboProjectNo > 0 Then
DoCmd.OpenForm "frmProject", acNormal, , , acFormReadOnly
Else
DoCmd.OpenForm "frmerror3"
End If
End Sub