DSum Not Working

I

iamnu

The following is producing a zero value for the DSum function. Can
someone explain what I've done wrong?

SELECT tblPayDetail.ProviderID, tblProvider.AcctID,
tblProvider.PayeeID, tblProvider.CoNameID, tblPayDetail.DatePaid,
tblPayDetail.BillPayAmt, CCur(Nz(DSum
("[BillPayAmt]","[tblPayDetail]","[AcctID] = " & [AcctID]))) AS
AcctTotal
FROM tblProvider INNER JOIN tblPayDetail ON tblProvider.ProviderID =
tblPayDetail.ProviderID;

Thanks,
Bernie
 
D

Duane Hookom

You have an Nz() with no second argument. Minimally try add the ,0 to the
expression.
CCur(Nz(DSum("[BillPayAmt]", "[tblPayDetail]", "[AcctID] = " & [AcctID]),0))
AS
AcctTotal

Is AcctID numeric?
 
I

iamnu

You have an Nz() with no second argument. Minimally try add the ,0 to the
expression.
CCur(Nz(DSum("[BillPayAmt]", "[tblPayDetail]", "[AcctID] = " & [AcctID]),0))
AS
AcctTotal

Is AcctID numeric?

--
Duane Hookom
Microsoft Access MVP

iamnu said:
The following is producing a zero value for the DSum function.  Can
someone explain what I've done wrong?
SELECT tblPayDetail.ProviderID, tblProvider.AcctID,
tblProvider.PayeeID, tblProvider.CoNameID, tblPayDetail.DatePaid,
tblPayDetail.BillPayAmt, CCur(Nz(DSum
("[BillPayAmt]","[tblPayDetail]","[AcctID] = " & [AcctID]))) AS
AcctTotal
FROM tblProvider INNER JOIN tblPayDetail ON tblProvider.ProviderID =
tblPayDetail.ProviderID;
Thanks,
Bernie

I added the 0 in the expression, and still get zero for the value of
AcctTotal.

Yes, AcctID is numeric. It comes from table zAcctNum which has a
Primary Key AcctID, and AcctNum as Text.

Bernie
 
D

Duane Hookom

Try replace the 2nd AcctID with a known AcctID value like:
CCur(Nz(DSum("[BillPayAmt]", "[tblPayDetail]", "[AcctID] = " & 123),0))
--
Duane Hookom
Microsoft Access MVP


iamnu said:
You have an Nz() with no second argument. Minimally try add the ,0 to the
expression.
CCur(Nz(DSum("[BillPayAmt]", "[tblPayDetail]", "[AcctID] = " & [AcctID]),0))
AS
AcctTotal

Is AcctID numeric?

--
Duane Hookom
Microsoft Access MVP

iamnu said:
The following is producing a zero value for the DSum function. Can
someone explain what I've done wrong?
SELECT tblPayDetail.ProviderID, tblProvider.AcctID,
tblProvider.PayeeID, tblProvider.CoNameID, tblPayDetail.DatePaid,
tblPayDetail.BillPayAmt, CCur(Nz(DSum
("[BillPayAmt]","[tblPayDetail]","[AcctID] = " & [AcctID]))) AS
AcctTotal
FROM tblProvider INNER JOIN tblPayDetail ON tblProvider.ProviderID =
tblPayDetail.ProviderID;
Thanks,
Bernie

I added the 0 in the expression, and still get zero for the value of
AcctTotal.

Yes, AcctID is numeric. It comes from table zAcctNum which has a
Primary Key AcctID, and AcctNum as Text.

Bernie
 
I

iamnu

Try replace the 2nd AcctID with a known AcctID value like:
CCur(Nz(DSum("[BillPayAmt]", "[tblPayDetail]", "[AcctID] = " & 123),0))
--
Duane Hookom
Microsoft Access MVP

iamnu said:
You have an Nz() with no second argument. Minimally try add the ,0 tothe
expression.
CCur(Nz(DSum("[BillPayAmt]", "[tblPayDetail]", "[AcctID] = " & [AcctID]),0))
AS
AcctTotal
Is AcctID numeric?
--
Duane Hookom
Microsoft Access MVP
:
The following is producing a zero value for the DSum function.  Can
someone explain what I've done wrong?
SELECT tblPayDetail.ProviderID, tblProvider.AcctID,
tblProvider.PayeeID, tblProvider.CoNameID, tblPayDetail.DatePaid,
tblPayDetail.BillPayAmt, CCur(Nz(DSum
("[BillPayAmt]","[tblPayDetail]","[AcctID] = " & [AcctID]))) AS
AcctTotal
FROM tblProvider INNER JOIN tblPayDetail ON tblProvider.ProviderID =
tblPayDetail.ProviderID;
Thanks,
Bernie
I added the 0 in the expression, and still get zero for the value of
AcctTotal.
Yes, AcctID is numeric.  It comes from table zAcctNum which has a
Primary Key AcctID, and AcctNum as Text.

Yes, that works for the specific AccID. Strange...
 
D

Duane Hookom

I think the issue is that both tblProvider and tblPayDetail both contain
AcctID and you aren't telling DSum() which one to use.

--
Duane Hookom
Microsoft Access MVP


iamnu said:
Try replace the 2nd AcctID with a known AcctID value like:
CCur(Nz(DSum("[BillPayAmt]", "[tblPayDetail]", "[AcctID] = " & 123),0))
--
Duane Hookom
Microsoft Access MVP

iamnu said:
On Jan 4, 9:55 pm, Duane Hookom <duanehookom@NO_SPAMhotmail.com>
wrote:
You have an Nz() with no second argument. Minimally try add the ,0 to the
expression.
CCur(Nz(DSum("[BillPayAmt]", "[tblPayDetail]", "[AcctID] = " & [AcctID]),0))
AS
AcctTotal
Is AcctID numeric?
:
The following is producing a zero value for the DSum function. Can
someone explain what I've done wrong?
SELECT tblPayDetail.ProviderID, tblProvider.AcctID,
tblProvider.PayeeID, tblProvider.CoNameID, tblPayDetail.DatePaid,
tblPayDetail.BillPayAmt, CCur(Nz(DSum
("[BillPayAmt]","[tblPayDetail]","[AcctID] = " & [AcctID]))) AS
AcctTotal
FROM tblProvider INNER JOIN tblPayDetail ON tblProvider.ProviderID =
tblPayDetail.ProviderID;
Thanks,
Bernie

I added the 0 in the expression, and still get zero for the value of
AcctTotal.
Yes, AcctID is numeric. It comes from table zAcctNum which has a
Primary Key AcctID, and AcctNum as Text.

Yes, that works for the specific AccID. Strange...
 

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