I've got a temp table that contains the fields: amountowed, amountpaid, and
balanced. I've got a form that shows this information and I've set it up so
that when the amountpaid field is changed it subtracts the amountpaid from
the amountowed and display's it in the balanced field.
Unfortunately it doesn't save what is displayed back to the table. It does,
however, save the changes to the amount paid field. I'm assuming my problem
is that the balanced field in the form is showing an expression as it's
control source so it's technically unbound. But when I bind it to the right
field in the table I can't get it to update anymore.
Long explanation just to ask...
Anyone know of a way to update fields 'on the fly' and still have the
calculated value saved to the underlying table?
-jeremy 3 5327
"Jeremy Weiss" <jw*****@hotmai l.com> wrote Anyone know of a way to update fields 'on the fly' and still have the calculated value saved to the underlying table?
If the calculated Control has the calculation expression in its Control
Source, then in the AfterUpdate event of each other Control that can be a
factor in the calculation, copy the content of the Calculated Control into a
Text Box control bound to the Field where you want it saved.
Alternatively, you could bind that Control to the Field that you want
updated, and perform the calculation in VBA code in the AfterUpdate event of
each other Control that can be a factor in the calculation.
Obligatory caution: if you are storing something that can be calculated from
other values when it is needed for display or use, then it is redundant
storage, and a violation of RDB design principles.
Larry Linson
Microsoft Access MVP bo*****@localho st.not (Larry Linson) wrote in
<6x************ **@nwrddc03.gni link.net>: "Jeremy Weiss" <jw*****@hotmai l.com> wrote
Anyone know of a way to update fields 'on the fly' and still have the calculated value saved to the underlying table?
If the calculated Control has the calculation expression in its Control Source, then in the AfterUpdate event of each other Control that can be a factor in the calculation, copy the content of the Calculated Control into a Text Box control bound to the Field where you want it saved.
Alternativel y, you could bind that Control to the Field that you want updated, and perform the calculation in VBA code in the AfterUpdate event of each other Control that can be a factor in the calculation.
Obligatory caution: if you are storing something that can be calculated from other values when it is needed for display or use, then it is redundant storage, and a violation of RDB design principles.
Er, not in the case of an apply payments temporary table, which is
what he's working on.
I do this with a checkbox field. You click the checkbox and the
AfterUpdate of the checkbox sets the balance and payment fields.
Because of that, you need an original balance field so you can
revert to it if you uncheck the invoice.
Say you have this:
InvTotal OrigBalance PmtAmt NewBalance
100.00 100.00 0.00 100.00
When you click the checkbox, the AfterUpdate changes it to:
InvTotal OrigBalance PmtAmt NewBalance
100.00 100.00 100.00 0.00
If you then uncheck, you zero out the PmtAmt field and reset
NewBalance to the same as OrigBalance.
OrigBalance is not displayed in the apply payments form. See: http://www.bway.net/~dfassoc/Park/Ap...sCustomer.html
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
----- Original Message -----
From: "David W. Fenton" <dX********@bwa y.net.invalid>
Newsgroups: comp.databases. ms-access
Sent: Wednesday, November 05, 2003 6:58 PM
Subject: Re: saving calculated values Er, not in the case of an apply payments temporary table, which is what he's working on.
I do this with a checkbox field. You click the checkbox and the AfterUpdate of the checkbox sets the balance and payment fields. Because of that, you need an original balance field so you can revert to it if you uncheck the invoice.
Say you have this:
InvTotal OrigBalance PmtAmt NewBalance 100.00 100.00 0.00 100.00
When you click the checkbox, the AfterUpdate changes it to:
InvTotal OrigBalance PmtAmt NewBalance 100.00 100.00 100.00 0.00
If you then uncheck, you zero out the PmtAmt field and reset NewBalance to the same as OrigBalance.
That's what I have in mind David. But I must ask, what happen's if the case
is something like:
InvTotal OrigBalance PmtAmt NewBalance
100.00 100.00 0.00 100.00
And the payment is only $80.
Does the clicking the checkbox activate something to check to see if
NewBalance <= PmtAmt ??
-jeremy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stefanos |
last post by:
Hi everybody,
I need some help on calculated values in my database design.
I'm creating an accounting / business management application with the
usual modules like A/R, A/P, Inventory, etc.
I don't know how to handle calculated values in fields like "Customer
Balance", "Inventory Item Qty on Hand", "Inventory Item Qty Last cost"
and other similar.
|
by: SJH |
last post by:
I have been given an older database and asked to make upgrades and what not.
One interesting thing I have come across with the database is that it was at
one time set up so one of the tables would hold values that were calcuated
using a form. I have looked at the code for all the text boxes on the
assocatied forms and have yet to figure out how this was done. There were
two values set up this way, one still works and the other one...
|
by: Henry |
last post by:
Hi
Is there any good ideas how to update form vb code always after some values
are changed / added by vb (not user).
I have some code behind subforms vb and there are calculations behind
"Form_Current" section those I need to re-calculate after some values are
changed or added.
The problem is that if list box value is calculated in vb, access wont
|
by: Douglas Buchanan |
last post by:
I set the OnExit property of the "Cost" field in subform
"subJobDetail" to save the record (see below). Then I call a global
sub to copy the )] calculated field to a field in the
subform "subJob". The record in "subJob" displays the "writing"
(pencil) icon for the record but does not update visually until I
enter and exit a second field "Markup" that is identically coded.
How do I write code to save the record in the subform "subJob"
...
|
by: douh |
last post by:
I know that this is not the way, however I need to save certian
calculated values so that they do not change over time, ie. new tax
rates etc. This is for an invoice header and invoice subform. I have a
form myheader and mysub that are linked via a invoice number. mysub
calculates qty * list = extprice. I am summing these into a sum_ext
field in mysub footer. I need to have this value updated into the
myheader invsubtot. I have tried many...
| |
by: tconway |
last post by:
I have an Access program that displays Customer data into a form and
OrderID data into a subform. The totals in the Subform are based on
calculated fields, i.e. the Total Amount field Calculates the
following: =*
The Subform Order fields are pulled from a Query along with each
calculated Total. They are displyed in a DataSheet View.
This works fine on my developement environment which includes a server
set up just as our client has. ...
|
by: TORQUE |
last post by:
Hi,
Im wondering if anyone can help me with a problem.
I have a form with more than 50 unbound fields.
Some of the fields will be blank from time to time.
This seems to be where im having trouble.
I have tried keeping some of the fields bound and when I use the save button
it has been saving as 2 different records. This is unacceptable.
This is what I have, can anyone help me out with this?
|
by: James Hallam |
last post by:
I have read through all the past topics and couldn't find what I was
after so...
I am looking to store some calculated values (don't flame just yet,
just read on!). I have an piece of code behind a form which calculates
a percentage completion and an expected completion date of a job. I
would like to store this information in a separate table, along with
the actual date the values were calculated.
Whenever a job is completed I can...
|
by: Gilberto |
last post by:
Hello,
I have created a query to help me calculate some total values i need for a report.
In the query field i have the following:
TCL1: Costing!*(Engineering!+Engineering!)
The results are calculated correctly for the report, however now i need this calculated values (from TCL1 on the query) to be stored in a table (COSTING) under the same field name (TCL1).
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |