Update Field while Scrolling thru Records

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have two tables.

Customers
Sales

In the customer table I have a field called OneWayMileage

in the sales table I have a field called TotlaRoundTripMiles

I have an Event in A lookup field that looks like below.

Sales_FirstName = Customers_FirstName
Sales_LastName = Customers_LastName
PhoneHome = HomePhone
TotalRoundTripMiles = OneWayMileage * 2

Problem is that sometimes I do not have the OneWayMileage info in the
customer file. So when I enter in a sale from a form, the two way mileage
is not calculated since the onewaymileage is blank (or zero).

I want to be able to scroll thru the records in the sales form and by
clicking in or past the TotalRoundTripMiles field and have it re-calculated
based on the OneWayMileage. The concept is that if I go into the customer
table and update the proper OneWayMileage, I want the sales record in the
sales table to be updated as I go thru each record.

I tried putting the calculation as an expresion and as code in a few events
for the TotalRoundTripMiles field but it did not work.

Thanks..... in advance.... Bob
 
This is the old storing calculated data in a table no no again. The better
way to do this is forget about the round trip milage in the table. As you
can see by your current problem, storing calculated data causes problems.

Write a function that does the calculation and put it in a standard module.
Then when you need to present it to a user, use it in a report, or whatever,
call the calculation function at that time.
 
Back
Top