Re: event update
- From: "justlearnin" <justlearnin@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 24 Jan 2006 12:24:03 -0800
Here is a better understanding of what I am trying to do.
Standard=amount to be kept on hand
Used=how many haave been used
Ordered=how many were ordered
CurrentCount=amount ordered
diff=amount to be carried over to next week
I'm not sure using a date field is what I need. Any other suggetions?
"Michel Walsh" wrote:
> Hi,
>
>
> You should do the computation in a query. Doing it under a form event means
> you have to get the right record and the right "event firing stimulus",
> which is quite unreliable.
>
>
>
> If your table have a dateTime field, then
>
>
> SELECT a.*, b.*
> FROM myTable As a LEFT JOIN myTable AS b ON b.dateTime < a.dateTime
> WHERE b.dateTime IS NULL or b.dateTime=(SELECT MAX(c.dateTime) FROM myTable
> as c WHERE c.dateTime<a.dateTime)
>
>
> should "match" the records such as b.* is the record occurring immediately
> before a.*. In other words
>
> a.fieldName - b.fieldName
>
>
> subtract the value in the said field name from two "successive" records
> (succession through their dateTime value).
>
>
> On the other hand, if you just need the SUM up to the datetime, a running
> sum, then, try:
>
>
> SELECT a.dateTime, SUM(b.amount)
> FROM myTable As a INNER JOIN myTable As b
> ON a.dateTime >= b.dateTIme
> GROUP BY a.dateTime
>
>
>
> Hoping it may help,
> Vanderghast, Access MVP
>
>
>
> "justlearnin" <justlearnin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:BE8C2240-DBE9-487F-8924-69949E386C4F@xxxxxxxxxxxxxxxx
> >I have a feild that I want to be updated from another feild in a form, but
> >I
> > cant use on current because it adds the value each time I open it. What
> > would
> > be the best event to use for this?
> > Me.Diff = Me.CurrentCount - Me.Standard
> > Diff is being passed so that it can be used in the next weeks totals. This
> > way the current count of the next week starts out with Diff added into it.
>
>
>
.
- Follow-Ups:
- Re: event update
- From: Michel Walsh
- Re: event update
- References:
- Re: event update
- From: Michel Walsh
- Re: event update
- Prev by Date: Running Access through browser
- Next by Date: RE: Autopopulate AutoFill Form
- Previous by thread: Re: event update
- Next by thread: Re: event update
- Index(es):
Relevant Pages
|