I have spent days trying to figure out why the INVOICE TOTAL only loads on my PaymentF (linked by button on OrderF) some of the time. I have discovered, when I click in OrderDetail (Subform of OrderF BEFORE clicking the Payment Button (on OrderF), the PaymentF INVOICE TOTAL loads correctly.
Is there a way in the code to fix this? I'll post images as well.
Thank you!
Lesli CochranOP
@Reply 4 years ago
Lesli CochranOP
@Reply 4 years ago
Kevin Robertson
@Reply 4 years ago
Try adding a Me.Refresh to the button code before the command to open PaymentF.
Lesli CochranOP
@Reply 4 years ago
Hi,
After adding me.refresh to button VBA: Clicking button opens form with $0 - Invoice Total
After clicking to enter a payment amount the Invoice Total appears - until I move to payment method and Invoice Total is $0 again.
Lesli CochranOP
@Reply 4 years ago
The payment form has:
On Current, After Update,
Me.Refresh
Forms!OrderF.Refresh
The OrderF will actually populate the correct amount paid and due.
Kevin Robertson
@Reply 4 years ago
How did you get the amount in the Invoice Total Text Box on the Payment Form?
In the Control Source, is it something similar to this:
=[Forms]![OrderF]![OrderDetailF].[Form]![SumLineTotal]
Lesli CochranOP
@Reply 4 years ago
Yes
Lesli CochranOP
@Reply 4 years ago
I've gotten to the point that it will populate the Invoice Total while Payment detail recored is Dirty, but after update the value goes back to zero.
The form is refreshed AfterUpdate, FormCurrent,
Kevin Robertson
@Reply 4 years ago
Can you post a screenshot of the Payment form in Design View?
Lesli CochranOP
@Reply 4 years ago
Lesli CochranOP
@Reply 4 years ago
Invoice Total Control Source =[Forms]![OrderF]![OrderDetailF].[Form]![GrandTotal]
Total Payments Control Source =Sum([PaymentAmount])
Amount Due Control Source =[InvoiceTotal]-[PaymentTotal]
Lesli CochranOP
@Reply 4 years ago
The code checks and refreshes the OrderF multiple times. Will this disengage the OrderDetailF which is a subform of OrderF. I feel like the problem lies in the refresh code.
Lesli CochranOP
@Reply 4 years ago
Or...should I create a Query with PaymentT and OrderDetailT for the control source of PaymentF. Maybe it's just too much calculations going on? On the OrderDetailF, the GrandTotal control source = =([SubTotal]+[TotalServiceCharge]+[TotalServiceChargeTax]+[TotalSalesTax]+[TotalAlcoholTax])
Kevin Robertson
@Reply 4 years ago
Really shouldn't make a difference as the GrandTotal has already been calculated when you click the button - but certainly give the query a try. Sometimes you have to go with whatever solution works best.
I've been trying to replicate your issue and so far, nothing I've tried has made the field behave that way. Guess it's a lot harder to break it when you actually want to. LOL
Lesli CochranOP
@Reply 4 years ago
I basically cut out all the coded refreshing. The Invoice Total calculates when I enter a Payment Amount and everything from there calculates and performs as expected so I think I'll take this as good enough! Thank you for your responses :)
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Developer 8.