Populate Continuous Forms (1 Viewer)

Kallu

Registered User.
Local time
Today, 04:09
Joined
Nov 4, 2011
Messages
18
Hi there.
I have Continuous Forms, to select article for customer, I have unbound text box to discount from total price. Example total price is $14, and I want to discount $4, after that i want $4 discount, to separate on article.
I have code to separate discount, but I can't populate all rows, on bound textbox, to save it on main table.
I try everything but not successed.
Can anybody help me to solve this?
 

Attachments

  • TextBox populate problem.accdb
    528 KB · Views: 55

Ranman256

Well-known member
Local time
Today, 07:09
Joined
Apr 9, 2015
Messages
4,337
On the form footer, is a textbox to sum the total: txtSubTot
=sum(txtAmt)

And a txtTotal box to sum txtSubTot and txtDisc.

TxtTotal=txtSubTot-txtDisc
On the form header is txtDiscount.
 

Kallu

Registered User.
Local time
Today, 04:09
Joined
Nov 4, 2011
Messages
18
I have code to calculate discount: Discount=([Discount1]/[Sum1]*[Sum]), but I want discount to save on table.

I can't add discount on bound textbox, i try this:
Me.CalculateDiscount = Me.Discount
Me.CalculateDiscount.Value = Me.Discount.Value

CaclcuateDiscount is Bound TextBox.

This populate only one row on continuous form. Only row which I moved cursor to txt Discount1. I tried also to refresh form but not succesed.
 

missinglinq

AWF VIP
Local time
Today, 07:09
Joined
Jun 20, 2003
Messages
6,423
I want discount to save on table.

Therein lies your problem! There very, very seldom is a reason to save calculated values to a Table and you shouldn't...you simply re-calculate it as needed, displaying in an Unbound Control (as suggested by Ranman256) whether in another Form or in a Report.

The exception to this rule would be if one or more components of the calculation are not actually Fields in the Record, but only referred to, using something like DLookup(), and I see nothing like that in your code.

A common example of this would be calculations involving tax rates, which can change over time, and a calculation done today, when viewing a Record form years ago, might not be accurate.

Linq ;0)>
 

Users who are viewing this thread

Top Bottom