1. “txt_FormulaID” stores formula ID.
2. “txt_ID” stores component ID.
3. “txt_ComponentName” stores component name.
4. “txt_QTY” allows user to enter quantity. Data Control Source bound to field “QTY”.
5. “txt_UOM” allows user to choose unit of measure, i.e., Lb, Oz, Kg, or G. Data Control Source bound to field “Unit”.
6. “txt_Conv” has Data Control Source bound to a calculated field, ConvWT, in the Query. The calculation is to convert the value in the txt_QTY to a new value based on gram. So far, this is working fine. The syntax is listed below.
7. “txt_Sum” is placed in the form footer and is supposed to sum all values in “txt_Conv”, but I cannot manage to make this work.
8. “txt_Wt%” is to calculate and return weight percentage of each component based on the calculated value in txt_Conv. This is where I am stuck, too.
Below is the syntax that I placed in the calculated Field in the query that bound to txt_Conv.
Expand|Select|Wrap|Line Numbers
- ConvWT: IIf([Unit]="G",[QTY],IIf([Unit]="KG",[QTY]*1000,IIf([Unit]="OZ",[QTY]*28.35*1000,IIf([Unit]="LB",[QTY]*16*28.35*1000,0))))
Expand|Select|Wrap|Line Numbers
- = SUM([txt_Conv])
Please help.
Thanks in advance!