calculations saved to table

T

Trisha_70

I have a text box in a form that does a calculation and I want it to save to
my table or a query, the Record source holds my calculation so it does not
hold the name of the field. HOW can I get the calculated value to show up in
the query or table?
 
D

Dan

Trisha, What I find best is to put the calculation in an event (expression,
macro, or code all works) and place the name of the field in the Control
Source for that textbox. It basically depends on when you need to caluclate
that value and find the event of that text box or some other control that
will perform the calculation when you desire.

Dan
 
T

Trisha_70

=([1st units]+[Total Units])
This is the calculation I perform, and I am not familiar with code. 1st
units and total units are fields in my table I input data into their and need
them added together so where would I find out about code to put in and where
and such? Thank you for the previous help.
 
J

Jeff Boyce

The general consensus in these newsgroups is that it is quite rare to need
to store a calculated value in a table.

Rather, is there a way you could do the calculation in a query?

"How" depends on "what" -- if you'll provide more specific description,
folks here may be able to offer more specific suggestions.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Dan

Trisha,

Depending on how your form functions, for example, if the [1st units] field
is filled in first then the [Total Units] is always filled in second. You
could then put the following VBA code in the AfterUpdate event of the [Total
Units] control:

dim Units as Integar
Units = me.[1st units] + me.[Total Units]
me.[OriginalTextBoxInQuestion] = Units
me.refresh

Dan
(am going to gym now, so won't be available for several hours)

Trisha_70 said:
=([1st units]+[Total Units])
This is the calculation I perform, and I am not familiar with code. 1st
units and total units are fields in my table I input data into their and need
them added together so where would I find out about code to put in and where
and such? Thank you for the previous help.


Trisha_70 said:
I have a text box in a form that does a calculation and I want it to save to
my table or a query, the Record source holds my calculation so it does not
hold the name of the field. HOW can I get the calculated value to show up in
the query or table?
 
T

Trisha_70

my table holds information of our clients, we have to calculate their hours 2
times a month when we do billing. The billing was set up to be entered in a
form that is associated with a query. Then a report is printed from the query
for some reason. This is a data base I inherited not one I set up. When the
hours are entered for the first half of the month and the second half, the
total should be in the units. I can't get the Units to show up in the query
or to print on my report. Units are just added and present in the form used.
I need it in the report. Units is a field in my table.
 
J

Jeff Boyce

"How" depends on "what"...

If you'll provide a description of the table structure and any SQL
statements for the queries, the folks here may be able to offer more
specific suggestions...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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

Similar Threads


Top