Jump to content

Looping Problem


Go to solution Solved by bcooney,

Recommended Posts

  • Newbies

Can somebody, please, help me with a looping problem.  I have a simple accounting procedure with 3 tables, Account, Transaction and TxnContra.  The Transaction table has the master side of the transaction and TxnContra has the opposite side.  E.g. Transaction receives $1,000 posted to account 1 and TxnContra has $500 for a/c 2 and $250 for each of accounts 3 & 4.

Records in TxnContra are in a portal of Transaction and new records can be added there.

When I post the Transaction, it posts the master amount to the account with the relevant foreign key and then it needs to post each of the contra items to the account with the foreign key that matches fkAccount in TxnContra.

As far as the first contra record is concerned the following code works perfectly but, because I go to the Account Layout, I lose my initial found set so I can't go to Next Record.  How do I either:

1.   Update the account table without moving away from my original Found Set; or

2.   Get back to the original Found Set and select the next record?

Get Found Set, Go to Record [First],

Loop: Set variable for fkAccount and Txn Amount, Go to Layout Account, find the record with the primary key to match fkAccount, update the Balance field by adding/subtracting the Amount variable.

Go to Record [Next]  How do I find the next record in the original Found Set?


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.