?
Solved

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

Posted on 2014-09-08
1
Medium Priority
?
326 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 38

Accepted Solution

by:
PatHartman earned 1500 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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