... my expression doesn't work ...

G

Guest

Please bear with me since I am not much more than a novice at creating
Databases.

I am trying to type an expression into the Control Source in a Text Box in a
Form. The expression is the common formula for the Volume of a Cylinder, V=
pi * D/2^ * L. I have tried simple formulas in the text box and they work
properly, so I think I must have a Syntax Issue.

I have three fields in my table; Diameter, Length and Volume. I type a value
into the Diameter and Length fields and I type my expression in the Volume
field. My expression is typed like this: <<< =(3.1415 *
(([Diameter]/2)^)*[Length]). But, I don't get the required results. As a
matter of fact, the expression is being saved as <<< =([Diameter]/2)*[Length]
I have type the expression in several forms that make sense to me, but none
have worked. Can someone straighten me out in regard to my expression?

Darrell
 
A

Al Camp

The first thing I notice is that your "square" function doesn't appear to
have a power value.
Try... Pi * (Diameter/2)^2 * Length (you had just ^ with no 2)

Since you are saving the Diameter and Length in your table, you won't
need to save Volume... it can always be recalculated "on the fly" in any
subsequent query, form, or report.

Just have a Diameter and Length field in your table.
On your form, place the "bound" text fields Diameter and Length.
Place an "unbound calculated text control" on the form with a
recordsource of...
=3.1415 * (Diameter/2)^2 * Length

Whenever you enter both a Diameter and Length, the unbound calculated
field will display the volume.
hth
Al Camp


Dr. Darrell said:
Please bear with me since I am not much more than a novice at creating
Databases.

I am trying to type an expression into the Control Source in a Text Box in
a
Form. The expression is the common formula for the Volume of a Cylinder,
V=
pi * D/2^ * L. I have tried simple formulas in the text box and they work
properly, so I think I must have a Syntax Issue.

I have three fields in my table; Diameter, Length and Volume. I type a
value
into the Diameter and Length fields and I type my expression in the Volume
field. My expression is typed like this: <<< =(3.1415 *
(([Diameter]/2)^)*[Length]). But, I don't get the required results. As a
matter of fact, the expression is being saved as <<<
=([Diameter]/2)*[Length]
I have type the expression in several forms that make sense to me, but
none
have worked. Can someone straighten me out in regard to my expression?

Darrell
 
D

Dirk Goldgar

Dr. Darrell said:
Please bear with me since I am not much more than a novice at creating
Databases.

I am trying to type an expression into the Control Source in a Text
Box in a Form. The expression is the common formula for the Volume of
a Cylinder, V= pi * D/2^ * L. I have tried simple formulas in the
text box and they work properly, so I think I must have a Syntax
Issue.

I have three fields in my table; Diameter, Length and Volume. I type
a value into the Diameter and Length fields and I type my expression
in the Volume field. My expression is typed like this: <<< =(3.1415 *
(([Diameter]/2)^)*[Length]). But, I don't get the required results.
As a matter of fact, the expression is being saved as <<<
=([Diameter]/2)*[Length]
I have type the expression in several forms that make sense to me,
but none have worked. Can someone straighten me out in regard to my
expression?

The power operator (^) requires a second operand specifying the power.
It doesn't mean just "squared". Try this:

=(3.1415 * (([Diameter]/2)^2)*[Length])

Of course, that's not a terribly accurate value for pi, but it may be
good enough for your purposes.
 
G

Guest

Al:

Thank you, I will try the power of 2, now that you mention it, it seems
obvious.

As far as using the query instead of a field in my table, I have a question
or comment.

I plan on exporting my table to an Excel Spreadsheet as one of my reports,
shouldn't the Volume Field be in the table? Or, are you saying that the
Volume Field should be linked to the query?

Darrell

Al Camp said:
The first thing I notice is that your "square" function doesn't appear to
have a power value.
Try... Pi * (Diameter/2)^2 * Length (you had just ^ with no 2)

Since you are saving the Diameter and Length in your table, you won't
need to save Volume... it can always be recalculated "on the fly" in any
subsequent query, form, or report.

Just have a Diameter and Length field in your table.
On your form, place the "bound" text fields Diameter and Length.
Place an "unbound calculated text control" on the form with a
recordsource of...
=3.1415 * (Diameter/2)^2 * Length

Whenever you enter both a Diameter and Length, the unbound calculated
field will display the volume.
hth
Al Camp


Dr. Darrell said:
Please bear with me since I am not much more than a novice at creating
Databases.

I am trying to type an expression into the Control Source in a Text Box in
a
Form. The expression is the common formula for the Volume of a Cylinder,
V=
pi * D/2^ * L. I have tried simple formulas in the text box and they work
properly, so I think I must have a Syntax Issue.

I have three fields in my table; Diameter, Length and Volume. I type a
value
into the Diameter and Length fields and I type my expression in the Volume
field. My expression is typed like this: <<< =(3.1415 *
(([Diameter]/2)^)*[Length]). But, I don't get the required results. As a
matter of fact, the expression is being saved as <<<
=([Diameter]/2)*[Length]
and the result is being displayed as this expression is typed.

I have type the expression in several forms that make sense to me, but
none
have worked. Can someone straighten me out in regard to my expression?

Darrell
 
G

Guest

Dirk:

Thank you, I will try that.

Darrell

Dirk Goldgar said:
Dr. Darrell said:
Please bear with me since I am not much more than a novice at creating
Databases.

I am trying to type an expression into the Control Source in a Text
Box in a Form. The expression is the common formula for the Volume of
a Cylinder, V= pi * D/2^ * L. I have tried simple formulas in the
text box and they work properly, so I think I must have a Syntax
Issue.

I have three fields in my table; Diameter, Length and Volume. I type
a value into the Diameter and Length fields and I type my expression
in the Volume field. My expression is typed like this: <<< =(3.1415 *
(([Diameter]/2)^)*[Length]). But, I don't get the required results.
As a matter of fact, the expression is being saved as <<<
=([Diameter]/2)*[Length]
and the result is being displayed as this expression is typed.

I have type the expression in several forms that make sense to me,
but none have worked. Can someone straighten me out in regard to my
expression?

The power operator (^) requires a second operand specifying the power.
It doesn't mean just "squared". Try this:

=(3.1415 * (([Diameter]/2)^2)*[Length])

Of course, that's not a terribly accurate value for pi, but it may be
good enough for your purposes.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
A

Al Camp

You can create a query that has a calculated column in it, just like the
calculated Volume field you have on your form.
Using query design grid, place Diameter and Length on the grid, and create a
3rd calculated column like this
Volume : 3.1415 * (Diameter/2)^2 * Length

Now you can Export the query to Excel.
hth
Al Camp

Dr. Darrell said:
Al:

Thank you, I will try the power of 2, now that you mention it, it seems
obvious.

As far as using the query instead of a field in my table, I have a
question
or comment.

I plan on exporting my table to an Excel Spreadsheet as one of my reports,
shouldn't the Volume Field be in the table? Or, are you saying that the
Volume Field should be linked to the query?

Darrell

Al Camp said:
The first thing I notice is that your "square" function doesn't appear to
have a power value.
Try... Pi * (Diameter/2)^2 * Length (you had just ^ with no 2)

Since you are saving the Diameter and Length in your table, you won't
need to save Volume... it can always be recalculated "on the fly" in any
subsequent query, form, or report.

Just have a Diameter and Length field in your table.
On your form, place the "bound" text fields Diameter and Length.
Place an "unbound calculated text control" on the form with a
recordsource of...
=3.1415 * (Diameter/2)^2 * Length

Whenever you enter both a Diameter and Length, the unbound calculated
field will display the volume.
hth
Al Camp


Dr. Darrell said:
Please bear with me since I am not much more than a novice at creating
Databases.

I am trying to type an expression into the Control Source in a Text Box
in
a
Form. The expression is the common formula for the Volume of a
Cylinder,
V=
pi * D/2^ * L. I have tried simple formulas in the text box and they
work
properly, so I think I must have a Syntax Issue.

I have three fields in my table; Diameter, Length and Volume. I type a
value
into the Diameter and Length fields and I type my expression in the
Volume
field. My expression is typed like this: <<< =(3.1415 *
(([Diameter]/2)^)*[Length]). But, I don't get the required results. As
a
matter of fact, the expression is being saved as <<<
=([Diameter]/2)*[Length]
and the result is being displayed as this expression is typed.

I have type the expression in several forms that make sense to me, but
none
have worked. Can someone straighten me out in regard to my expression?

Darrell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top