verification problem

  • Thread starter Thread starter Colleen
  • Start date Start date
C

Colleen

I have a data entry form that displays one record at a
time. I want to execute some code before moving onto the
next record to check whether the sales data entered (in a
subform) totals to the amount of money received (entered
on the form itself). If the amounts do not match I print
an error message and do not move to the next record until
the out of balance condition is rectified, either by
editing data in the subform or the form. Ideally I would
like to perform this verification immediately before
leaving the record. I cannot figure out an event to
capture this properly every time. If I use the "after
update" event on various fields on the form that may have
changed, I do not catch edits made to the subform only.
I do not want to check for the condition every time an
involved field value is changed, because the user should
have the flexibility to edit previously entered values on
the form without having to satisfy the error check until
all editing is complete (ie., when ready to move to the
next record). I have considered programming my own
navigation buttons for movement to other records, but am
hoping there is an easier way.
 
Hi Colleen,

Try putting
Me.Dirty
in the form's Current event.

This will force the form's BeforeUpdate event to run, and you can call
your verification code from there.

You may have to set the focus to a suitable control before you can dirty
the form. Access seems not to like forms being dirtied when the focus is
set to controls that aren't bound to editable fields.




I have a data entry form that displays one record at a
time. I want to execute some code before moving onto the
next record to check whether the sales data entered (in a
subform) totals to the amount of money received (entered
on the form itself). If the amounts do not match I print
an error message and do not move to the next record until
the out of balance condition is rectified, either by
editing data in the subform or the form. Ideally I would
like to perform this verification immediately before
leaving the record. I cannot figure out an event to
capture this properly every time. If I use the "after
update" event on various fields on the form that may have
changed, I do not catch edits made to the subform only.
I do not want to check for the condition every time an
involved field value is changed, because the user should
have the flexibility to edit previously entered values on
the form without having to satisfy the error check until
all editing is complete (ie., when ready to move to the
next record). I have considered programming my own
navigation buttons for movement to other records, but am
hoping there is an easier way.

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Back
Top