Dsum Problem

J

Jonas

I want to use the Dsum function on a continuous subform. I want to
get a sum of a field in the subform based on a unique ID in the main
form. I know that I have the main form and the subform linked
properly. I have done this before but I can't figure out how to do it
now. Do I need to put the Dsum function in the footer of the
continuous subform? Below are my fields, tables and forms.

Main form: frmPayments
Subform: frmEnterCashBills

Main table: tblPayments
sub table: tblCashBillsEntry

I tried to use the following in the footer of the subform to see if I
could get anything but an error or a #name but I couldn't get it to
work. I have a field in the main fom that refers to the field in the
footer of the subform

=dsum("tblCashEntryBillAmount","tblCashBillsEntry","frmCashEntryUnIDfrPmts='29""
 
K

Ken Snell

Yes, the control to show the sum must go in the subform's Footer section.

The syntax for your DSum expression would be this:

=DSum("tblCashEntryBillAmount","tblCashBillsEntry","frmCashEntryUnIDfrPmts='29'")


This assumes that the field you wish to sum is tblCashEntryBillAmount, the
table that contains the field is tblCashBillsEntry, the tblCashBillsEntry
table contains a field named frmCashEntryUnIDfrPmts, and the field
frmCashEntryUnIDfrPmts is a text datatype field.

If the above assumptions are incorrect, please provide revised information.
 
J

Jonas

Yes, the control to show the sum must go in the subform's Footer section.

The syntax for your DSum expression would be this:

=DSum("tblCashEntryBillAmount","tblCashBillsEntry","frmCashEntryUnIDfrPmts=­'29'")

This assumes that the field you wish to sum is tblCashEntryBillAmount, the
table that contains the field is tblCashBillsEntry, the tblCashBillsEntry
table contains a field named frmCashEntryUnIDfrPmts, and the field
frmCashEntryUnIDfrPmts is a text datatype field.

If the above assumptions are incorrect, please provide revised information.
--

        Ken Snellhttp://www.accessmvp.com/KDSnell/










- Show quoted text -

That is exactly what I have. I get "#name?" in the textbox that
refers to the textbox in the footer of the subform. Do you have any
suggestions?
 
K

Ken Snell

Questions:

1) What is the name of the textbox on main form that is referencing the
textbox in the subform's footer section?

2) What is the name of the subform control that holds the subform (open main
form in design view, click on top edge of subform control, open Properties,
click on Other, read Name property value)?

3) What is the name of the textbox in the subform's footer section?

--

Ken Snell
http://www.accessmvp.com/KDSnell/


Yes, the control to show the sum must go in the subform's Footer section.

The syntax for your DSum expression would be this:

=DSum("tblCashEntryBillAmount","tblCashBillsEntry","frmCashEntryUnIDfrPmts=­'29'")

This assumes that the field you wish to sum is tblCashEntryBillAmount, the
table that contains the field is tblCashBillsEntry, the tblCashBillsEntry
table contains a field named frmCashEntryUnIDfrPmts, and the field
frmCashEntryUnIDfrPmts is a text datatype field.

If the above assumptions are incorrect, please provide revised
information.
--

Ken Snellhttp://www.accessmvp.com/KDSnell/










- Show quoted text -

That is exactly what I have. I get "#name?" in the textbox that
refers to the textbox in the footer of the subform. Do you have any
suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top