November 22, 20223 yr 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? Loop
November 22, 20223 yr Solution Crest a new window and then do the find for the account. Close when done.
Create an account or sign in to comment