Calculation on Form with control not on table

hayashig

Registered User.
Local time
Today, 12:47
Joined
Jul 1, 2010
Messages
28
I am using MS Access 2007. I have a problem that may be simple, but I have yet to figure out the solution to by looking through the forum.

I am trying to use a BMI calculation using the form. None of the controls ie. weight and height has a field on the table, and I also do not need to have the calculation recorded.

So far I have the controls: [Weight], [Height1], [Height2], and [BMI Calc]

On the Control Source of the [BMI Calc] I have used the equation
= (703*[Weight])/((12*[Height1]+[Height2])^2

The [Height1] is in feet so it must be converted to inches and added with [Height2] which is in inches for total height in inches.

The BMI calculation is as follows: BMI=(703*(Weight))/((Height)^2)

So far the equation only gives in #NAME which I'm certain is an error on the calculation part since the controls for weight and height are not giving an error.
 
refer to weight [weight] not (weight)
 
My current calculation uses [Weight] rather than (Weight) the second formula I posted is the Actual BMI formula, not the one I used.
 
You can have 10's or 100's of unbound text box controls on your form and these can display all sorts of calculated data from either bound or unbound controls on your form.

You refer to the variables in your calculation [controlname]
 
If this doesn't work = (703*[Weight])/((12*[Height1]+[Height2])^2

try to break up with more brackets. Also, as typed, you have uneven brackets
 
The calculation you gave me gives me an error: Expression you entered is missing a closing parenthesis, bracket, or vertical bar.

= (703*[Weight])/((12*[Height1]+[Height2])^2
 
Also ensure that Weight, Height1 and Height2 are the ACTUAL names of the textboxes. It would show #Error if the calculation is incorrect. Another thing is check the TAB ORDER of the controls to ensure that Weight comes before Height1 and Height2 etc.

It would be best to perform this calculation on a query instead.

Finally, look into the Val(), Nz() and IIF() functions, you may need those.
 
I put in one of the missing parenthesis = (703*[Weight])/((12*[Height1]+[Height2])^2) and it fixed the calculation which I can use now. Thank you so much PNGBill your assistance was most helpful.
 
The calculation you gave me gives me an error: Expression you entered is missing a closing parenthesis, bracket, or vertical bar.

= (703*[Weight])/((12*[Height1]+[Height2])^2

I copied your post. It is your post that is missing brackets.
 
You have one too many parens here (in red):

= (703*[Weight])/((12*[Height1]+[Height2])^2
 
UNLESS it is supposed to be:


= (703*[Weight])/((12*[Height1])+[Height2])^2
 

Users who are viewing this thread

Back
Top Bottom