Using Formula In Access

N

Nick T

Hi,
Iv created an access database using tables & forms. I have command buttons
which input relivant data into text boxes which is then saved in a table.
However, i wondered if i could get text boxes to automatically calculate
things in a simular way to Excel?
For example, an 'operator' enters the number '100' into text box A using
command buttons. Following this, i want text box B to automatically display
half of the number which is inputted into text box A.
In excel it would be a simple '=a/2' equasion in box b, but can simular be
done in access?
Any help would be greatly appreciated.

Many thanks
Nick
 
F

fredg

Hi,
Iv created an access database using tables & forms. I have command buttons
which input relivant data into text boxes which is then saved in a table.
However, i wondered if i could get text boxes to automatically calculate
things in a simular way to Excel?
For example, an 'operator' enters the number '100' into text box A using
command buttons. Following this, i want text box B to automatically display
half of the number which is inputted into text box A.
In excel it would be a simple '=a/2' equasion in box b, but can simular be
done in access?
Any help would be greatly appreciated.

Many thanks
Nick

I don't understand why you need to enter a value into a text box using
a command button. If you enter a value into a control on a form that
is bound to a field in your table, the value is automatically stored
in the table.

Be that as it may, in the control source of the second UNBOUND text
control on your form, write:
=[ControlA]/2
This value will then appear on the form. It will not be saved in any
table, nor should it. As long as you have the value in ControlA saved
in your table, any time you need to see the result of the calculation
at some later time, on form or report, simply re-calculate it, using
the same expression.
 
N

Nick T

Hi,
Thanks for the help - so far so good!
Yes, it may sound a bit odd, but its all to eliminate potential operator
error. I cant rely on the operators to manually type details into text
boxes, therefore am using comand buttons, so that only certain things can be
added into a text box.

Anyway, what you said has helped, however i do need this info to feed back &
be stored in a table. Usually i would set the control source of the text box
to the field in the table i want the data to appear in, however when putting
your [xx]/2 formula in the control source, this means that the data is only
seen in the form view, where as i also want to see it in the table view.

Any suggestions?
Thanks
Nick

fredg said:
Hi,
Iv created an access database using tables & forms. I have command buttons
which input relivant data into text boxes which is then saved in a table.
However, i wondered if i could get text boxes to automatically calculate
things in a simular way to Excel?
For example, an 'operator' enters the number '100' into text box A using
command buttons. Following this, i want text box B to automatically display
half of the number which is inputted into text box A.
In excel it would be a simple '=a/2' equasion in box b, but can simular be
done in access?
Any help would be greatly appreciated.

Many thanks
Nick

I don't understand why you need to enter a value into a text box using
a command button. If you enter a value into a control on a form that
is bound to a field in your table, the value is automatically stored
in the table.

Be that as it may, in the control source of the second UNBOUND text
control on your form, write:
=[ControlA]/2
This value will then appear on the form. It will not be saved in any
table, nor should it. As long as you have the value in ControlA saved
in your table, any time you need to see the result of the calculation
at some later time, on form or report, simply re-calculate it, using
the same expression.
 
S

Stockwell43

Hi Nick,

What Fred was saying is you don't need to see it in table view because you
should not store calculation in the table. Instead of seeing it in table
view, you want to create a report and view it there using the same
information from your textbox B of your form to place in the Report.

Nick T said:
Hi,
Thanks for the help - so far so good!
Yes, it may sound a bit odd, but its all to eliminate potential operator
error. I cant rely on the operators to manually type details into text
boxes, therefore am using comand buttons, so that only certain things can be
added into a text box.

Anyway, what you said has helped, however i do need this info to feed back &
be stored in a table. Usually i would set the control source of the text box
to the field in the table i want the data to appear in, however when putting
your [xx]/2 formula in the control source, this means that the data is only
seen in the form view, where as i also want to see it in the table view.

Any suggestions?
Thanks
Nick

fredg said:
Hi,
Iv created an access database using tables & forms. I have command buttons
which input relivant data into text boxes which is then saved in a table.
However, i wondered if i could get text boxes to automatically calculate
things in a simular way to Excel?
For example, an 'operator' enters the number '100' into text box A using
command buttons. Following this, i want text box B to automatically display
half of the number which is inputted into text box A.
In excel it would be a simple '=a/2' equasion in box b, but can simular be
done in access?
Any help would be greatly appreciated.

Many thanks
Nick

I don't understand why you need to enter a value into a text box using
a command button. If you enter a value into a control on a form that
is bound to a field in your table, the value is automatically stored
in the table.

Be that as it may, in the control source of the second UNBOUND text
control on your form, write:
=[ControlA]/2
This value will then appear on the form. It will not be saved in any
table, nor should it. As long as you have the value in ControlA saved
in your table, any time you need to see the result of the calculation
at some later time, on form or report, simply re-calculate it, using
the same expression.
 
N

Nick T

Excelent!
Problem solved!

Thanks Both.
Nick


Stockwell43 said:
Hi Nick,

What Fred was saying is you don't need to see it in table view because you
should not store calculation in the table. Instead of seeing it in table
view, you want to create a report and view it there using the same
information from your textbox B of your form to place in the Report.

Nick T said:
Hi,
Thanks for the help - so far so good!
Yes, it may sound a bit odd, but its all to eliminate potential operator
error. I cant rely on the operators to manually type details into text
boxes, therefore am using comand buttons, so that only certain things can be
added into a text box.

Anyway, what you said has helped, however i do need this info to feed back &
be stored in a table. Usually i would set the control source of the text box
to the field in the table i want the data to appear in, however when putting
your [xx]/2 formula in the control source, this means that the data is only
seen in the form view, where as i also want to see it in the table view.

Any suggestions?
Thanks
Nick

fredg said:
On Tue, 15 Apr 2008 08:06:01 -0700, Nick T wrote:

Hi,
Iv created an access database using tables & forms. I have command buttons
which input relivant data into text boxes which is then saved in a table.
However, i wondered if i could get text boxes to automatically calculate
things in a simular way to Excel?
For example, an 'operator' enters the number '100' into text box A using
command buttons. Following this, i want text box B to automatically display
half of the number which is inputted into text box A.
In excel it would be a simple '=a/2' equasion in box b, but can simular be
done in access?
Any help would be greatly appreciated.

Many thanks
Nick

I don't understand why you need to enter a value into a text box using
a command button. If you enter a value into a control on a form that
is bound to a field in your table, the value is automatically stored
in the table.

Be that as it may, in the control source of the second UNBOUND text
control on your form, write:
=[ControlA]/2
This value will then appear on the form. It will not be saved in any
table, nor should it. As long as you have the value in ControlA saved
in your table, any time you need to see the result of the calculation
at some later time, on form or report, simply re-calculate it, using
the same expression.
 

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