AfterUpdate data that is already there

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I imported an excel file into a form. I made the form the way I want it and
added some unbound fields. The unbound fields are a subtotal and total. I
have my code and it works fine, but I have to go to some of the other fields
and retype the value so that my subtotal and total will recalulate. Is there
a better place to put my code instead of the AfterUpdate so that when you
enter into the form it automatically updates? And do I have to do my code
for each field or is there a place to do it that speaks to the entire form.
Thank You.
 
I imported an excel file into a form. I made the form the way I want it and
added some unbound fields. The unbound fields are a subtotal and total. I
have my code and it works fine, but I have to go to some of the other fields
and retype the value so that my subtotal and total will recalulate. Is there
a better place to put my code instead of the AfterUpdate so that when you
enter into the form it automatically updates? And do I have to do my code
for each field or is there a place to do it that speaks to the entire form.
Thank You.

You are attempting to use Access the same way you use Excel.
Don't. They do not work the same way.

Delete the Subtotal and Total fields from your table.
Import just the data needed for the calculations from Excel.
When inputting new data, again input just the data needed for the
calculations.

When you need the Subtotal and Total information, compute it.
In a query:
SubTotal:[FieldA] + [FieldB]
Total:([FieldA] + [FieldB] + [Shipping] ) * [TaxRate]

Or you can compute the Subtotal and Total directly on your form or in
your report, using unbound text controls:
=[FieldA] + [FieldB]
=([FieldA] + [FieldB] + [Shipping] ) * [TaxRate]

But do not store the calculated data, It's not necessary.
 
Is there
a better place to put my code instead of the AfterUpdate so that when you
enter into the form it automatically updates?

I'd do the calculations in the Query upon which the form is based, if
they are per-row calculations; then they'll always be there. If you're
doing totals in a form footer, then you should see the data correctly;
if not, you might need to put a line Me.Recalc in the Form's Current
event.

John W. Vinson [MVP]
 

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

Back
Top