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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

expressions in tables

Status
Not open for further replies.

yourdeployedson

Programmer
Feb 8, 2006
11
US
I have a form that draws most of its information from a table. However, there are a few fields that have expressions in them because they need to do calculations. How can I get the results to save within my table without me having to manually type the result in every time.
 
Aren't the calcalations done from data within the table? If so, then the results should not have to be typed in every time. You can't store expressions in a table - that must be done in a query. Storing the results of a calculation in a filed is a waste of space as it should be able to be re-calculated from existing data.

Have fun! :eek:)

Alex Middleton
 
Ok, is there a way that that the calculations done within a form can save the results within my table. for example

form box =DateDiff("yyyy",[DOB],Now())+Int(Format(Now(),"mmdd")<Format([DOB],"mmdd"))

now I need the result to appear in the table automatically in the appropriate location so I can calculate totals in the database.
 
You really want to store in a table informations that change every day ?
Have a look here:

To retrieve the allways current info, simply add a calculated field in a query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes, as PHV says, you should use a query for this, not store the results in the table. That is very bad database design.

Have fun! :eek:)

Alex Middleton
 
Your question makes sense if you need a date/time when a record was created/changed. In that case look at DefaultValue of a field (in table design) or BeforeChange or other events of form/textbox (in VBE). This should allow either to store those dates in table and next use them in query, or add calculation result, if already fixed, to a field.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top