Tb_in for the data table, "name of commodity", "warehouse number", "put in storage unit price" for the field name
Database link: the Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source="& amp; App. The Path & amp; "\ db_sjk. MDB; Persist Security Info=False
In tb_in table registration order
ID number name of commodity warehousing storage unit price
1 a 10, 210
2 a 12 220
3 a 15 200
(every time to register as a warehouse batch, this question commodity name is a, for example, only the actual may contain b, c, d,... )
Help problem:
If Text1=name of commodity, Text2=number of outbound, in Text3 outbound amount? Unit price (quantity *)
For outbound amount must find and calculate in commodity warehousing registration order,
Such as a commodity:
Text2=8, outbound amount is 8 * 210=1680
Text2=13, outbound amount is 10 * 210 (the first batch quantity * unit price) + 3 * 220 (the number of the second batch of 3 * unit price)=2760
Text2=32, outbound amount is 10 * 210 (the first batch quantity * unit price) + 12 * 220 (second batch quantity * unit price) 200 + 11 * (the number of the third batch 11 * unit price)=4300
Due to this problem is involved in a project application, how can't change the table structure, according to the above requirements in Text3 outbound amount calculated results ?
CodePudding user response:
Open the form should be in order to open the first, and then a a lookup to calculate the amount