Re: how to add to field from previous record
- From: Wayne-I-M <WayneIM@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 24 Sep 2006 15:07:02 -0700
Hi Larry
Maybe I misunderstood - I can't see anything wrong with updateing a previous
record when data is added to the next.
eg.
25 cans of beans sold yesterday
2 can of beans added to an order
That mean we really sold 27 can of beans.
Or
25 cans of beans sold yesterday
2 can of beans added to an order
This could mean that we have 2 extra cans sold today
I'm confused
There is no problem and no rules are broken if a record is used to update a
previous record providing that the data is is linked to the primary of the
record being updated -
I'm still confused
Oh well - live goes on
--
Wayne
Manchester, England.
Enjoy whatever it is you do
"Larry Daugherty" wrote:
Hi Blondie,.
The question in your post title doesn't really express your intent.
Achieving your intent as later clarified involves breaking at least
one rule for relational databases. "Wayne-I-M" has helped you to
do that. :-)
The effective data rule goes something like this: "The content of
each field in a record is the result of the Primary Key of that record
alone and not the result of a calculation of any other data within
this database, so help me Codd". E.F. Codd and C.J. Date were the
fathers of SQL and DB2 (that little utility manufactured by Itty Bitty
Machines - otherwise known as IBM. I suggest that you view
www.mvps.orf/access and, in particular, read the Ten Commandments.
You've expressed what you want but in a relational database what you
want is illegal. The functionality you seek involves two levels: the
level of the data itself and the level of information about the data.
The data is in the record about *this* trip segment. That record
should store only things about *this* trip segment. You need another
level to show the total distance as the sum of all of the individual
distances. You could have an unbound textbox on your form and update
it in the OnChange event of the "segment distance" textbox.
Re-calculate information every time you need to display it, don't
store the results of calculations in tables. (There are some special
instances where there is a clear need to store calculated results,
such as Invoices... Your current situation doesn't involve one of
those special instances).. The same kind of thinking applies in
Reports but the Report designer gives you tools to address summing
issues directly.
For a working example of the results you might be seeking, go to
www.mapquest.com ask for travel directions and enter two geographic
points and look at the results returned.
Post back if you have issues in achieving a correct solution
HTH
--
-Larry-
--
"Wayne-I-M" <WayneIM@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DA50B4AF-DC81-42E7-9FAF-2914A67E07C2@xxxxxxxxxxxxxxxx
Hisimply
You can code this - there are many examples on the web - or you can
use the DLookUp functioneither
DLookUp will look at a record that is a specified number of records
behind or front of your current record in the table.by
You can refer to a previous record - in this case the preceeding one
using -1 In the control source of a field in your current record.Of course
you "can" simply add the current record's number to the DLookUpfield in the
same formula but I have found that it is useful to have a seperateunbound
field and refer to that - something like [UnBoundName] +[YourField]
=DLookUp("[FieldName]","TableName","[PrimaryField]=Forms![FormName]![I
In the case the UnBoundfield's record source would look like this.
D]-1")
how would
Change to what you normally use
FieldName
TabeName
PrimaryField
FormName
Hope this helps
--
Wayne
Manchester, England.
Enjoy whatever it is you do
"Blondie" wrote:
if i want to update a value from a previous record by adding to it
kilometresi do that. If the cumulative value in the first record shows 100
want theand the next record asks trip distance and i input 25 kilometres i
high and lowcumulative distance to update. is this possible. i've searched
who can beand i can't work out if this is possible. thank you to anybody
of assistance
- Follow-Ups:
- Re: how to add to field from previous record
- From: Larry Daugherty
- Re: how to add to field from previous record
- References:
- how to add to field from previous record
- From: Blondie
- Re: how to add to field from previous record
- From: Larry Daugherty
- how to add to field from previous record
- Prev by Date: Re: Form directory needed.
- Next by Date: Conserving values in Sub & SubSub forms.
- Previous by thread: Re: how to add to field from previous record
- Next by thread: Re: how to add to field from previous record
- Index(es):
Relevant Pages
|
Loading