Solved

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

Posted on 2014-09-08
1
311 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 34

Accepted Solution

by:
PatHartman earned 500 total points
Comment Utility
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now