Enquiry about Form / SubForm doing caluclate

s1police

Registered User.
Local time
Tomorrow, 04:27
Joined
Aug 1, 2007
Messages
50
Dear,

I am now developing a project database with cost allocation...etc.
I have created the 3 control tabs in 1 form. Please see "FormView.JPG".

And now, I would like to show the subtotal of "Cost_allocation_percentage_rate" in text8 text box. I assume that the subtotal should be 100%.

However, I got 2 questions,

Please see "DesignView1.JPG"
Q1: If I put the textbox in Subform, I try the formula Sum([cost_allocation_percentage_rate]), it cannot work, show "#Error".
What formula I should use if I put the textbox in Subform?

Please see "DesignView2.JPG"
Q2: If I put the textbox in Cost Allocation tab, I also try the formula Sum as above, it also cannot work, show "#Error". What formula I should use if I put the textbox in tab?

Please help.
 

Attachments

  • FormView.JPG
    FormView.JPG
    67.7 KB · Views: 128
  • DesignView1.GIF
    DesignView1.GIF
    65.3 KB · Views: 136
  • DesignView2.GIF
    DesignView2.GIF
    58.9 KB · Views: 137
Q1: If I put the textbox in Subform, I try the formula Sum([cost_allocation_percentage_rate]), it cannot work, show "#Error".
What formula I should use if I put the textbox in Subform?
you need to put the same formula that you used to calculate [cost_allocation_percentage_rate] in the sum function. So, something like:
=Sum(IIf([Your2ndFieldNameHere]=0,0,[YourFieldNameHere]/[Your2ndFieldNameHere]))
(Make sure that your field names and text boxes are NOT named the same. Name your text boxes something like txt_cost_allocation_percentage_rate and then refer to the FIELD name in the sum formula.

then in the control on the main form, it would be this to refer to the sum text box:

=[Forms]![SubFormNameHere]![YourSumTextBoxNameHere]
 
Got it!! Thanks!!!!
 

Users who are viewing this thread

Back
Top Bottom