Public Sub SetAllowEdits(ByVal NewValue As Boolean)
Dim aob As AccessObject
Dim boolOpened As Boolean
For Each aob In CurrentProject.AllForms
If Not CurrentProject.AllForms(aob.Name).IsLoaded Then
DoCmd.OpenForm aob.Name, acDesign, , , , acHidden
boolOpened = True
End If
Forms(aob.Name).AllowEdits = NewValue
If boolOpened Then
DoCmd.Close acForm, aob.Name, acSaveYes
boolOpened = False
End If
Next aob
End Sub
I can't remember for sure, do you need to call a function, not a sub, from
an autokeys macro? If so, just change the above sub to a function, or create
a wrapper function to call the sub.