[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 643
  • Last Modified:

automatically enter data into form field

I have a form with 3 fields. fields a, b, and c. I would like field c to be equal to a*b. what do i put in the property sheed of field c to achieve this?
2 Solutions
If you are NOT storing the data to teh table then you can put the controlsource as =[a]*[b]
If you have the controls on the form linked to fields then in the AfterUpdate of A and B you need to put

Me!c = Me!a * Me!b

Cheers, Andrew
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Access cannot refer to other columns at the table level ... you could do this on a Form as Andrew suggests, or you could build a Query:

SELECT ColA, ColB, (ColA + ColB) AS ColC FROM YourTable

This would show you the sum of A + B for each record in YourTable. However, generally you do NOT store calculated values in a Table, since Access can recreate this as needed (re: the query example), and you should generally do that to insure that your data is always correct. Otherwise, if someone comes along later and changes the value in ColA and forgets to update ColC, your data is skewed.
Forced accept.

EE Admin

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now