Dsum in subform makes me Subdumb

G

gagetpro

Problem: I have a subform with 3 fields & want to sum dollars in 1st based
on text value of 2nd and store in 3rd.
Main form named F_DepositSlip & Record source is table M_DepositSlip; sub
form named fsC_PayFundsAllocationSelForDeposit & Source Object FS_DepositSel.
1st named: txtFundPaidAmount
Control Source: FundPaidAmount of table M_DepositSlip
2nd named: cboTypeFunds_IDs of table M_DepositSlip
Control Source: FundPaidTypeFunds_IDs
Row Source: SELECT L_TypeFund.TypeFund_ID, L_TypeFund.TypeFundName
FROM L_TypeFund ORDER BY [TypeFundName];
3rd Named: txtCurrency
Control Source:
=DSum([txtFundPaidAmount],[fsC_PayFundsAllocationSelForDeposit],
[cboTypeFunds_IDs]="Currency")

get Error> The object dosen’t contain the Automation object
‘fsC_PayFundsAllocationSelForDeposit’
 
G

Guest

I do not believe that you are specifying the parameters of a domain
aggregrate function (DSum in this case) correctly. Try enclosing the domain,
expression and criteria terms in double quotes. You shouldn't need the square
brackets, since you are not using spaces or special characters in the names
of your objects, although including them should be okay too. Something like
this:

=DSum("[txtFundPaidAmount]","[fsC_PayFundsAllocationSelForDeposit]",
"cboTypeFunds_IDs= Currency")

Use this page as a guide. Although written for DLookup, the DSum function
would be very similar:
http://www.mvps.org/access/general/gen0018.htm

Since you appear to be taking criteria from a combo box, you might need to
try this:

=DSum("[txtFundPaidAmount]","[fsC_PayFundsAllocationSelForDeposit]",
"FundPaidTypeFunds_IDs= '" &
forms!fsC_PayFundsAllocationSelForDeposit!cboTypeFunds_IDs & "'")

But that's just a guess....


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
S

Svetlana

It could be something like this

=IIf(Nz(Forms!F_DepositSlip!fsC_PayFundsAllocationSelForDeposit!cboTypeFunds_IDs)=0;0;DSum(CLng(FundPaidAmount);"M_DepositSlip";"FundPaidTypeFunds_IDs="
&
Forms!F_DepositSlip!fsC_PayFundsAllocationSelForDeposit!cboTypeFunds_IDs))

and you set the format property for the txtCurrency control to currency.
 

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