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

HELP, need an expression for default value in a table.

Status
Not open for further replies.

SteelDragon

Programmer
Feb 1, 2001
134
US
Hello All,

I have a default value in a table I need to be calculated from 2 other fields in that table. here is the SQL query that does it, but I cannot get it to work as an expression in the default value field.

UPDATE [ToP] SET [ToP].TOPWeight = ([ToP]![RWAttacker]+[ToP]![RWDefender])/2;


the query runs great, but I need this to work on an access database that is on a Cold fusion server. If I could get the field to auto update or take the change as data is entered that is what I require. Or if I can put a macro or something in a web page to kick off (trigger) the update that could work also. Is there ANY way to get a default value to be (x+y)/2 ??

SteelDragon
 
Try

([ToP]![RWAttacker]+[ToP]![RWDefender])/2;
 

Why store a calculated value pn the table. It can be calculated in a query whenver needed. This is standard database design practice.

If there is an overriding reason for storing the calculated value, why not update the column when you store the record? Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top