Solved

Ms Access Auto populating a field based on a value on a form

Posted on 2014-09-08
1
316 Views
Last Modified: 2014-09-18
I have several fields on a form:
Price = [user enters and it is added to a table]
Qty = 19 (user enters)
each price = $.0489 (user enters)

total price:  $9.291 (calculation on the form based on [qty]*[each price]

the user can enter a qty and a each price which would give them a total price.  How do I get the total price to populate in the Price field?  The price is populated with default values or the user can overwrite the default value)
0
Comment
Question by:deefel
1 Comment
 
LVL 36

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40310890
As long as you keep the UnitPrice and the quantity, there is no need to keep the ExtendedPrice.  It is far better practice to calculate it in the query.  Doing the calculation in the query will also automatically populate the ExtendedPrice field on the form.  
Select ..., UnitPrice, Quantity, UnitPrice * Quantity AS ExtendedPrice
From ...;

If you insist on doing this in the form (against expert advice) then you have to worry about when to do the calculation.  You either have to do it in both the AfterUpdate event of the UnitPrice and Quantity fields or you would do it in the BeforeUpdate event of the Form.

Me.txtExtendedPrice = Me.txtUnitPrice * Me.txtQuantity
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question