G
Guest
In order that I can build a change history and 'track back' to a record's
contents at any particular time I have created a form which allows the adding
of new records only.
The form is set to data entry, allows filters and edits and contains a
subform in the header section which lists all of the records in the table.
The detail part of the form contains the fields to be updated. (allow filters
and edits are required to allow records in the subform to be filtered and
edited, but all of the fields are set to enabled=true, locked=false)
When one of the records in the subform is double clicked, vba code populates
the new fields on the main form with the same information as the selected
record. (Ready to be modified)
If I then double click on another of the records in the subform the new
fields on the main form are repopulated with the new selection as expected.
(This caters for a wrong initial selection)
The problem is that as soon as I click on one of the new fields on the main
form to modify the data the main form before update event is triggered. The
before update event code is simply:
if msgbox("Update?",vbyesno)=vbno then me.undo
I only want the beforeupdate event to be triggered if I change the new field
contents and I don't understand why it is being triggered before I have
changed anything or tried to save the new record (either by clicking the save
button or moving off the main form). I presume it has something to do with
moving from the subform to the main form but don't see why.
Can someone please explain, or is there a better way of doing this?
Many thanks in advance
Ptero
contents at any particular time I have created a form which allows the adding
of new records only.
The form is set to data entry, allows filters and edits and contains a
subform in the header section which lists all of the records in the table.
The detail part of the form contains the fields to be updated. (allow filters
and edits are required to allow records in the subform to be filtered and
edited, but all of the fields are set to enabled=true, locked=false)
When one of the records in the subform is double clicked, vba code populates
the new fields on the main form with the same information as the selected
record. (Ready to be modified)
If I then double click on another of the records in the subform the new
fields on the main form are repopulated with the new selection as expected.
(This caters for a wrong initial selection)
The problem is that as soon as I click on one of the new fields on the main
form to modify the data the main form before update event is triggered. The
before update event code is simply:
if msgbox("Update?",vbyesno)=vbno then me.undo
I only want the beforeupdate event to be triggered if I change the new field
contents and I don't understand why it is being triggered before I have
changed anything or tried to save the new record (either by clicking the save
button or moving off the main form). I presume it has something to do with
moving from the subform to the main form but don't see why.
Can someone please explain, or is there a better way of doing this?
Many thanks in advance
Ptero