Thanks Albert

I will give it a try.

Marc

----- Original Message ----- 
From: "Albert Berry" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, September 01, 2004 2:45 PM
Subject: [RBG7-L] - Re: Form calculation


> Marc, here's one way to do this. I did not create a db and test this code,
but any errors should
> be easy to find.
>
> Insert your base data, and have one other column for the RunningBalance.
>
> CREATE TEMP TABLE TmpRunningBalance +
>   (RunBalID INTEGER NOT NULL PRIMARY KEY, +
>   InvDate DATE, +
>   InvNum, +
>   CustID INTEGER, +
>   Amount CURRENCY, +
>   RunningBalance CURRENCY)
> AUTONUM RunBalID IN TmpRunningBalance USING 1
> INSERT INTO TmpRunningBalance (CustID, InvDate, InvNum, Amount) +
>   SELECT CustID, InvDate, InvNum, Amount FROM Invoices +
>   ORDER BY CustID, InvDate, InvNum +
>   WHERE ....
> CREATE TEMP VIEW TmpBalances (RunBalID, Balance) AS +
>   SELECT t1.RunBalID, SUM(t2.Amount) +
>   FROM TmpRunningBalance +
>   WHERE t2.RunBalID <= t1.RunBalID +
>   GROUP BY t1.RunBalID
> UPDATE TmpBalances +
>   SET RunningBalance = t2.Balance +
>   FROM TmpBunningBalance t1, TmpBalances t2 +
>   WHERE t1.RunBalID = t2.RunBalID
>
> --- Marc <[EMAIL PROTECTED]> wrote:
>
> > Hi Bernie
> >
> > That part makes sense but how do you get the
> > formula to use the Balance from the line above,
> > then add the next lines charges - the payments.
> >
> > Marc
> >
> >
> > > Marc,
> > > If a value is changed, place a bit button on your form with caption
"Save
> > > Changes", create an eep that does a saverow.  Put a hint in, that says
"If
> > > you made any changes, click here to update"
> > > Then refresh the form.
> > > Bernie Lis
> > > ----- Original Message ----- 
> > > From: "Marc" <[EMAIL PROTECTED]>
> > > To: "RBG7-L Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, September 01, 2004 8:47 AM
> > > Subject: [RBG7-L] - Form calculation
> > >
> > >
> > > > HI all
> > > >
> > > > Is it possible to have a forumla something like a spreadsheet
> > > > in a region.
> > > >
> > > > I want something like this
> > > > Charge   payment   Balance
> > > > $50           $0           $50
> > > > $50          -$20         $80
> > > >
> > > > and if you changed one of the payments or charges the balance
> > > > on that line would be re-calculated and all of the rows below
> > > > as well.
> > > >
> > > > I can figure out how to do one line but I can't figure out how to
> > > > include the Balance form the line above.
> > > >
> > > > Thanks
> > > > Marc
> > > >
> > > > --- RBG7-L
> > > > ================================================
> > > > TO POST A MESSAGE TO ALL MEMBERS:
> > > > Send a plain text email to [EMAIL PROTECTED]
> > > >
> > > > (Don't use any of these words as your Subject:
> > > > INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
> > > > REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
> > > > ================================================
> > > > TO SEE MESSAGE POSTING GUIDELINES:
> > > > Send a plain text email to [EMAIL PROTECTED]
> > > > In the message SUBJECT, put just one word: INTRO
> > > > ================================================
> > > > TO UNSUBSCRIBE:
> > > > Send a plain text email to [EMAIL PROTECTED]
> > > > In the message SUBJECT, put just one word: UNSUBSCRIBE
> > > > ================================================
> > > > TO SEARCH ARCHIVES:
> > > > Send a plain text email to [EMAIL PROTECTED]
> > > > In the message SUBJECT, put just one word: SEARCH-n
> > > > (where n is the number of days). In the message body,
> > > > place any
> > > > text to search for.
> > > > ================================================
> > > >
> > > >
> > >
> > >
> >
> >
>
>
> =====
> Albert Berry
> Management Consultant
> RR2 - 1252 Ponderosa Drive
> Sparwood BC, V0B 2G2
> Canada
> (250) 425-5806
> (250) 425-7259
> (708) 575-3952 (fax)
> [EMAIL PROTECTED]
>
>

Reply via email to