Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculated Field needs to be copied to Field in Table

Status
Not open for further replies.

RobotMush

Technical User
Aug 18, 2004
197
US
I have successfully created a field that calculates the date seven years after data from another field. My problem now is getting the data that was calculated moved or copied to the proper field in my table.

Example.
Table "Year Field", "Year + 7 Field"
Query "Year Field", "Year + 7 Calculated Field"

Need to have the data in the "Year + 7 Calculated Field" moved or copied to the "Year + 7 Field"

Is this possible?

Thank you for your help in this matter.
 
What you want is to make an update query and put your formula in for the new value of that field.

TMTOWDI - it's not just for Perl any more
 
First, why? Calculated fields SHOULD NOT be stored. As ong as the value displays correctly on the form, you should not need to store it. It will only increase the size of your database and eventually may lead to bad data as well.

But if you feel you must (and there are a few valid reasons for saving calculated data), just set the ControlSource of the field that has the calculated value to the name of the field in the table that will store the data. That of course assumes that the table is the source for the form in the first place. If not, you will need an update query as adalger suggested.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Thank you Adalger, I'll read up on it in my Access Bible before trying it. Was unable to change the Control Source without getting errors.

Robotmush (Technical User, self taught)
 
Thank you mstrmage1768, however I am unable to make changes to the Control Source without getting errors. I.E. "#Name?"
I'll read up on the Update Query in my Access Bible and see if that works.

Thank you for your help and suggestions.

Robotmush (Technical User, self taught)
 
if you are updating an entire table to a calculated field you would use an update query

create new query
pick the table you are updating
change the query type to update query
drag the "Year + 7" field you want to update to the query columns
in the 'update to' field put your calculation you used in your other query on Year eg.[Year]+7

this will add 7 to the current value of the Year and place it in the Year + 7 field for each record

I usually save a copy of the table I am updating first if I am unsure of the results (Just in case!) :-0



 
Thank you TechnoDuh for telling me how to set up the update query. Your instructions are quiet helpful and after having read some in my "Access Bible" I am able to follow what you are telling me. (I.E. I know enough about it now to aske the smartter dumb questions.)

Got the Update Query up and running and it is working great.

Thank you again for your help and input.

Robotmush (Technical User self taught)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top