Hi all,
I have this code at the "Form Current" Event. When a user activates a new record, I wanted to let them know how many times the value in txtOrderAmt appears in the column Order_amt, and also the sum of the values.
So, if 300 is in txtOrderAmt at the current record, then count how many times 300 appears, and the sum - the sum is in a seperate txtbox. I can't get it to work right though. This works on text field, but I am having problem with this because order_amt is not text. I would be grateful for any help. Thank you!
I have this code at the "Form Current" Event. When a user activates a new record, I wanted to let them know how many times the value in txtOrderAmt appears in the column Order_amt, and also the sum of the values.
So, if 300 is in txtOrderAmt at the current record, then count how many times 300 appears, and the sum - the sum is in a seperate txtbox. I can't get it to work right though. This works on text field, but I am having problem with this because order_amt is not text. I would be grateful for any help. Thank you!
Code:
If Not Me.txtOrderAmt = "" Then
MyDcountI = DCount([order_amt], "MyTable", [order_amt] = Me.txtOrderAmt)
MyOrderMCount = MyDcountI
MyDsumI = DSum([order_amt], "MyTable", [order_amt] = Me.txtOrderAmt)
MyOrderMSum = FormatCurrency(MyDsumI, 0)
Else
Me.MyOrderMCount = 0
Me.MyOrderMSum = 0
End If