Thanks Allen & Cheryl for replying. I did not explain myself fully. I wanted
to see first if I would get a response as no-one responded to my posts at
microsoft.public.access!
By now I am also getting confused with all the permutations I have tried.
I have a form with subform (Invoices and Invoice details) and I want to
prevent changes to old invoices while allowing entry of new invoices.
If I change AllowEdits to No on the main form property sheet while keeping
it "yes" on the subform property sheet I can make additions to the main form
but not the subform (the new record indicator (*) for the subform is faded
out). This does not make sense. Can you explain.
I have resorted to the following code which looks quite cumbersome - is this
the best way to handle this?
Private Sub Form_Current()
If NewRecord = True then
With Me.Invoice_Details_Subform.Form
Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = True
.AllowEdits = True
.AllowDeletions = True
.AllowAdditions = True
Else
Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False
.AllowEdits = False
.AllowDeletions = False
.AllowAdditions = False
End With
End If
End Sub
Allen made the following suggestion, but I don't quite follow in what
situation this would be applied. Please explain.
If the form is dirty, Microsoft (wisely) allows you to override the
AllowEdits and finish what you are doing. You may therefore want to code:
If Me.Dirty Then
Me.Dirty = False
End If
Me.AllowEdits = False
Many Thanks
Laurence