Unanswered: Record save when moving from Detail to Header
I have an form that consists of a header with an unbound control that is used to select the record shown in Detail. This works correctly.
In the Detail section are the fields from the master table and sub-forms with fields from linked tables. Everything works fine with one exception:
If info in a field in Detail is updated and then the unbound header control is selected, and another name entered; the VBA code to find the requested record doesn't get executed [Runtime Error 3020; Update or Cancel Update without AddNew or Edit], and eventually there is a message:
You can't save this record at this time.
Microsoft Access may have encountered an error while trying to save a record.
If you close this object now, the data changes you made will be lost.
Do you want to close the database object anyway?
Clicking the DeBug in the 3020 error message highlights the Me! line in the Code for the form:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me![DateLastUpdate].Value = Now()
I've taken to doing a PgUp or PgDn after doing my work so the changes are processed prior to clicking in the Header field.
What is the best solution for this. Do I need to change the Form_BeforeUpdate and make one for each field, (I hope not)?