Link to home
Start Free TrialLog in
Avatar of LISA GEORGE
LISA GEORGE

asked on

Calculate sum based on 2xtextboxes

Hi all, i have continuous  form with rate and quantity text boxes so sometimes values can be null as well
i have button total cost so when user clicks on that button it needs to display sum(rate*quantity) of all the rows
i tried using vba code on click event of that button as
Me.button.Value = DSum(Rate * Quantity, "tablename", "tableid = me.id.value")
but when i run this id = me.id.value is taking null value
any idea on this how to get that total cost ignoring null values
tableid = me.id.value is criteria i am using where tableid is column in table and id is textbox value(this value in not null)  in my form

FYI atm to display that total cost in the footer i am using unbound textbox where controlsource is expression =Format(Sum([Rate]*[Quantity]),"Currency") which is working fine
but now user wants to display that value on click of a button
thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LISA GEORGE
LISA GEORGE

ASKER

Thank you guys, it worked
@gustav ---Also:
when i run this id = me.id.value is taking null value
but then you state:
id is textbox value(this value in not null)

it's taking null value when i debug code for that Dsum function though i already have value for that ID text box in my form because i came to know that it's my syntax error

also as i want that in sub sub form so i want to group that based on ID value

anyways now my problem is resolved..appreciate for your help guys