Are you putting that code in your main form or your subform where you may have archived records? It should either be in the subform or you need to change the code to affect the subform. To do things in a subform from VBA in the main form, your syntax would look like:
Me.subControlName.Form.AllowEdits