P
Paul James
I'm trying to add up the values of all records in a total field that have
been paid, and I'd like to display this sum of paid totals in the form
footer. I've been trying to accomplish this with DSum which I know how to
use when I'm looking up values in a table. I've tried specifying the
arguments in DSum to total the specified values in the form by replacing the
field and table names with every possible articulation of the form and
control specs I could think of, such as
formcontrolname
me!formcontrolname
forms!formname!formcontrolname
but again, I can't get past the #Error message.
Can anyone help me with this? Please assume the object names are:
txtTotal - the name of the form control I'm trying to sum up with DSum
frmReceiptSub - the name of the form that contains txtTotal
chkPaid - the name of the "Paid" checkbox control in frmReceipt
txtSumTotal - the name of the form footer control that I'm putting the
DSum() function into.
If this is relevant, the fields in the query underlying frmReceipt are named
"Total" and "Paid."
I suppose I could obtain the values for for txtSumTotal from the query
recordset, but what I'm trying to do with this form, which is a subform of
another form, is to instantaly display the Total value of all paid invoices
as soon as the Paid field of another Invoice is checked. I figured that if
I'm doing all the calculations in the form, I could bypass worrying about
refreshing and requerying the underlying table and query. Hence it will be
faster and simplify the VBA code behind my forms.
Can anyone tell me how to write the DSum() function?
Thanks in advance,
Paul
been paid, and I'd like to display this sum of paid totals in the form
footer. I've been trying to accomplish this with DSum which I know how to
use when I'm looking up values in a table. I've tried specifying the
arguments in DSum to total the specified values in the form by replacing the
field and table names with every possible articulation of the form and
control specs I could think of, such as
formcontrolname
me!formcontrolname
forms!formname!formcontrolname
but again, I can't get past the #Error message.
Can anyone help me with this? Please assume the object names are:
txtTotal - the name of the form control I'm trying to sum up with DSum
frmReceiptSub - the name of the form that contains txtTotal
chkPaid - the name of the "Paid" checkbox control in frmReceipt
txtSumTotal - the name of the form footer control that I'm putting the
DSum() function into.
If this is relevant, the fields in the query underlying frmReceipt are named
"Total" and "Paid."
I suppose I could obtain the values for for txtSumTotal from the query
recordset, but what I'm trying to do with this form, which is a subform of
another form, is to instantaly display the Total value of all paid invoices
as soon as the Paid field of another Invoice is checked. I figured that if
I'm doing all the calculations in the form, I could bypass worrying about
refreshing and requerying the underlying table and query. Hence it will be
faster and simplify the VBA code behind my forms.
Can anyone tell me how to write the DSum() function?
Thanks in advance,
Paul