Calculated Field

rube

Registered User.
Local time
Today, 23:18
Joined
Jun 21, 2003
Messages
76
I have a box that is a calculation of a line item, [txtPrice],[txtPercent], and [txtQuantity]. This is called the line item total. This form subLineItem, is a subform of frmTicket. The problem is the calculation differs depending on if it is a wholesale or retail base price.

Is there a way to put an if statement in the control of the calculated box, or make it conditional and calculate according?

I tried using the OnCurrent of the Parent Form to call the calculation, but it then made all the LineItemTotals the same, I also tried sending the algorithm as a string which would not work. I finally had to just create two new forms/tables, one for Retail Base and the other Wholesale. It just means double the work and variables.

Is there a way around this?

Thanks,

Chris
 
tag..

May be you can use something like "CustomerType" and then have a drop down "R for retail" and "W for wholesale".

Then use if command.

If customertype = r then [a]*[c]
else
*[c]

It's hard to read people's mind without the actual database. May be you can put Access 97 version of your database if you are still confuse.

GOOD LUCK.
Dianna Jamil
 
ControlSource

I appreciate your response.

If I put the If statement in the ControlSource Property, it gives a #Name? when I run it. If I put an If statement on the main form, and put in the calculation, it will give an error (because the fields are on the sub form), if put the proper annotation for the subform, it assigns all values to all the Extended Price fields on the subform, if I send it as a string, it will just put the string in the field.

Is this what you meant, or did I miss something? I appreciate your input.

Rube
 
rube,

Base your form on a query and add a new field. Use the
IIf function to calculate your total.

Alternatively, if they update the data, you can use the
BeforeUpdate event for the fields and call a public function
to calculate the total for your unbound textbox.

hth,
Wayne
 
IIf

Wayne,
I completely forgot all about that. Thanks so much, sorry to hit you here so much....

Thanks again,

Rube
 

Users who are viewing this thread

Back
Top Bottom