Hi. I have a form called RFP Entry. On it is a subform (RFP Expenses subform).
In the continuous subform for a new expense record, I choose a doctor from a combo box (Doctor_ID), select an account from a combo box(Account), and fill in an amount of the expense in a text box (Amount). Each doctor has a professional enrichment(PE) balance (PE Balance) associated with him/herself. If the account I choose is "7" (which is for professional enrichment), then after I fill in the amount, I would like for the database to check my PE balance and see if I have enough money to cover the expense. So, if my PE balance was $5,000 and I tried an amount of $5,500, then a box would appear that said that I can't create that expense at this time. If the amount is lower than the balance, then after I leave that record and go on to the next one, I would like it to subtract that amount from the PE balance back in the Doctor Numbers table so that for the next PE expense that is created either on the current main form record or a later one, the new balance is what the next PE amount is checked against.
All the while though, I worry that if the record in the main form is not completed and they decide to forget about it and try it again later, then I would like to have some way for them to "undo" their changes in the main form, subform, and the PE balance update.
I created a dlookup box in the subform that does lookup the doctor's current balance. And I was on my way to creating a macro that would run before the subform record is updated to check to see if the amount on that row is lower than the current balance. But, everything has gotten scrambled in my head, and I'm not sure how to proceed.
Let me know what additional info you need, if you have some thoughts...
Thanks!
In the continuous subform for a new expense record, I choose a doctor from a combo box (Doctor_ID), select an account from a combo box(Account), and fill in an amount of the expense in a text box (Amount). Each doctor has a professional enrichment(PE) balance (PE Balance) associated with him/herself. If the account I choose is "7" (which is for professional enrichment), then after I fill in the amount, I would like for the database to check my PE balance and see if I have enough money to cover the expense. So, if my PE balance was $5,000 and I tried an amount of $5,500, then a box would appear that said that I can't create that expense at this time. If the amount is lower than the balance, then after I leave that record and go on to the next one, I would like it to subtract that amount from the PE balance back in the Doctor Numbers table so that for the next PE expense that is created either on the current main form record or a later one, the new balance is what the next PE amount is checked against.
All the while though, I worry that if the record in the main form is not completed and they decide to forget about it and try it again later, then I would like to have some way for them to "undo" their changes in the main form, subform, and the PE balance update.
I created a dlookup box in the subform that does lookup the doctor's current balance. And I was on my way to creating a macro that would run before the subform record is updated to check to see if the amount on that row is lower than the current balance. But, everything has gotten scrambled in my head, and I'm not sure how to proceed.
Let me know what additional info you need, if you have some thoughts...
Thanks!