I need an sql statement in my form which selects a product of two fields in a table and then counts them all together.
The statement should look as follows:
sum1 = "SELECT Count([Field1] * [Field2]) WHERE [Field3] <> 'ml' AND [FieldDate] >= txtDate1 AND [FieldDate] <= txtDate2
sum2 = "SELECT Count([Field1] * ([Field2]/100)) WHERE [Field3] = 'ml' AND [FieldDate] >= txtDate1 AND [FieldDate] <= txtDate2
txtSum = sum1 + sum2
When I input dates in Text Boxes txtDate1 and txtDate2, and press button btnCalculate, I need the sum of sum1 and sum2 to be filled automatically in a Text Box txtSum.
How should the code look like, to be written behind a button's btnCalculate on click event?
Thanks in advance.
The statement should look as follows:
sum1 = "SELECT Count([Field1] * [Field2]) WHERE [Field3] <> 'ml' AND [FieldDate] >= txtDate1 AND [FieldDate] <= txtDate2
sum2 = "SELECT Count([Field1] * ([Field2]/100)) WHERE [Field3] = 'ml' AND [FieldDate] >= txtDate1 AND [FieldDate] <= txtDate2
txtSum = sum1 + sum2
When I input dates in Text Boxes txtDate1 and txtDate2, and press button btnCalculate, I need the sum of sum1 and sum2 to be filled automatically in a Text Box txtSum.
How should the code look like, to be written behind a button's btnCalculate on click event?
Thanks in advance.