(The record cannot be deleted or changed because 'tblinvoice' includes related records.
I have a form "Transactions", It has a sub-form "Invoices".
Originally I locked all the fields on transactions so the user could enter in invoices in a datasheet view in the "invoices' sub-form and attach them to the current transaction displayed above in the Transaction form. Then they wanted a lock unlock button in case they wanted to edit the transaction data in the Transaction form so I entered in:
So....
I did:
Now what is going on is the following. If you make the form "dirty" then try to close out:Code:Private Sub cmdLockUnlock_Click() Dim ctrl As Control Dim strControl As String strControl = Me.ActiveControl.Name On Error Resume Next For Each ctrl In Me.Controls With ctrl If .Name <> strControl Then .Locked = Not .Locked End If End With Next ctrl End Sub
I can't think of how to deal with this. Do I need to save the subform, then the form with an if dirty?


Reply With Quote


