V
Vel.
Hello,
I have a form where users enter client payments into a payments table based
on charges in an activity table. For the purposes of my question, the
relevant bits of table structure are as follows:
tblActivity
ActivityID, ClientID, DateOf, ClientCharge
tblPayments
PaymentID, ActivityID, ClientPayment, ClientAdjustment
In my form, the user enters a ClientID and a DateOf value to limit the
possible activities to select from for entering a payment into tblPayment.
There is a subform (subBalance) which calculates the ClientBalance based on
ClientCharge-nz(Sum(ClientPayment))+nz(Sum(ClientAdjustment))
the value is stored in the field txtBalance
On the main form are the following fields
txtClientID, txtDateOf, txtActivityID, txtClientPaid, txtClientAdjusted
On the afterUpdate event of txtClientPaid I have some code which checks to
see if the amount paid is less than, equal to, or greater than txtBalance.
If it is less than, the user must determine whether the balance should stay,
or be adjusted off. If it is equal to, no action is taken. If it is greater
than (here's where I need help), there should be two options.
Option A: Adjust the balance onto the client's charge (this part I can do)
Option B: Post the balance to previous dates of service (this part I can't
do)
Essentially, if they choose "Option B", I want to use the remaining balance
to add new records to tblPayment for each ActivityID which currently has an
outstanding balance, starting with the earliest.
For example
John Doe was seen on the 1st, 5th, 9th, and 15th; and had a charge of $25
each time. He made a payment only on the 15th, of $90. The user goes to
post this payment to the ActivityID which corresponds to the 15th, and the
prompt comes up to let them know that by posting $90 to this date they would
create a $75 credit balance and they can choose Option A or Option B.
If they choose Option B, the system would then insert a new payment into
tblPayments for $25.00 with the activityID corresponding to the 1st, a second
corresponding to the 5th, and a $10.00 corresponding to the 9th, leaving the
client with an overall balance of $15, which would be based on the charge
from the 9th.
I know this may seem like an odd way to structure the charges, but it is
necessary for "paper trail" type purposes to have each line have its own
charge, which can subsequently be paid individually. I imagine the code
would need to utilize some sort of DoWhile type loop, but that is a bit of
coding I'm not familiar with utilizing in Access. Any help would be greatly
appreciated.
I have a form where users enter client payments into a payments table based
on charges in an activity table. For the purposes of my question, the
relevant bits of table structure are as follows:
tblActivity
ActivityID, ClientID, DateOf, ClientCharge
tblPayments
PaymentID, ActivityID, ClientPayment, ClientAdjustment
In my form, the user enters a ClientID and a DateOf value to limit the
possible activities to select from for entering a payment into tblPayment.
There is a subform (subBalance) which calculates the ClientBalance based on
ClientCharge-nz(Sum(ClientPayment))+nz(Sum(ClientAdjustment))
the value is stored in the field txtBalance
On the main form are the following fields
txtClientID, txtDateOf, txtActivityID, txtClientPaid, txtClientAdjusted
On the afterUpdate event of txtClientPaid I have some code which checks to
see if the amount paid is less than, equal to, or greater than txtBalance.
If it is less than, the user must determine whether the balance should stay,
or be adjusted off. If it is equal to, no action is taken. If it is greater
than (here's where I need help), there should be two options.
Option A: Adjust the balance onto the client's charge (this part I can do)
Option B: Post the balance to previous dates of service (this part I can't
do)
Essentially, if they choose "Option B", I want to use the remaining balance
to add new records to tblPayment for each ActivityID which currently has an
outstanding balance, starting with the earliest.
For example
John Doe was seen on the 1st, 5th, 9th, and 15th; and had a charge of $25
each time. He made a payment only on the 15th, of $90. The user goes to
post this payment to the ActivityID which corresponds to the 15th, and the
prompt comes up to let them know that by posting $90 to this date they would
create a $75 credit balance and they can choose Option A or Option B.
If they choose Option B, the system would then insert a new payment into
tblPayments for $25.00 with the activityID corresponding to the 1st, a second
corresponding to the 5th, and a $10.00 corresponding to the 9th, leaving the
client with an overall balance of $15, which would be based on the charge
from the 9th.
I know this may seem like an odd way to structure the charges, but it is
necessary for "paper trail" type purposes to have each line have its own
charge, which can subsequently be paid individually. I imagine the code
would need to utilize some sort of DoWhile type loop, but that is a bit of
coding I'm not familiar with utilizing in Access. Any help would be greatly
appreciated.