Do action for each record

D

Darcy

I have a form that allows me to edit the records of a table.

One of the records is calculated.

So I therefore have to calculated it every time the user makes a change.

The compromise is to do it in the after_update (or should I use
before_update)?

Worse yet, there are several sub forms. If a change is made in the Subform.


Any ideas on how I can do this?

If I have to, I'll just do the calculation unconditionally each time the
user tries to leave the record but what event should I use for that?

Thanks in advance.
 
J

John Vinson

I have a form that allows me to edit the records of a table.

One of the records is calculated.

Ordinarily one would not store calculated fields in a table. Are you
certain that it is necessary to do so at all?
So I therefore have to calculated it every time the user makes a change.

The compromise is to do it in the after_update (or should I use
before_update)?

Before_Update if the record being updated contains the calculated
field (it's already been written to disk and cannot be changed in the
Form's AfterUpdate event).
Worse yet, there are several sub forms. If a change is made in the Subform.

If a change is made... what??
Any ideas on how I can do this?

If I have to, I'll just do the calculation unconditionally each time the
user tries to leave the record but what event should I use for that?

Form_BeforeUpdate.
 
D

Darcy

Hello John,

Thanks for the reply.

I see your suggestion for unconditionally running code each time the user
leaves the record (Form_beforeUpdate).

This only runs IF a change was made on the form so its not unconditional.

The difficulty I'm having is that when changes are made on the Subforms, I
want to run a calculation on the main form. The Form_beforeUpdate doesn't
seem to run when I make changes on the subforms so my calculation isn't
being run at all in those cases.

Darcy
 
J

John Vinson

The difficulty I'm having is that when changes are made on the Subforms, I
want to run a calculation on the main form. The Form_beforeUpdate doesn't
seem to run when I make changes on the subforms so my calculation isn't
being run at all in those cases.

Run the code in each Subform's AfterUpdate event as well, then.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top