Query Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The query below is giving me an error message "can't find the name
tblTemp!YrPrd you entered in the expression". Here's the SQL:

SELECT CnvStatus, DocType, Year, PrdNbr, YrPrd, OCrp, OAcct, HComp, HAcct,
EndBal, DSum("[EndBal]","[tblHGLDetailsSummaryBS_woDesc]","[YrPrd] <
[tblTemp]![YrPrd]") AS BegBal
FROM tblHGLDetailsSummaryBS_woDesc INNER JOIN tblHGLDetailsSummaryBS_woDesc
AS tblTemp ON (YrPrd = tblTemp.YrPrd) AND (HAcct = tblTemp.HAcct) AND (HComp
= tblTemp.HComp) AND (OAcct = tblTemp.OAcct) AND (OCrp = tblTemp.OCrp) AND
(PrdNbr = tblTemp.PrdNbr) AND (Year = tblTemp.Year) AND (DocType =
tblTemp.DocType) AND (CnvStatus = tblTemp.CnvStatus);

The calculation for BegBal is intended to be the sum of EndBal where YrPrd <
tblTemp.YrPrd, but obviously something isn't working right. Any advice would
be appreciated!
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Try the DSum() like this (I formatted it so it is easier to read):

DSum("[EndBal]",
"[tblHGLDetailsSummaryBS_woDesc]",
"[YrPrd] < " & [tblTemp].[YrPrd]) AS BegBal

SQL Standard is to use a period between table names and column names,
not an exclamation point.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQlLPKoechKqOuFEgEQL7eACgnf1wscnlWa+EXS7nNWevZbcJnTIAn0tQ
yrJeiXnB1nRrd0iplADD1Lm0
=8rg0
-----END PGP SIGNATURE-----
 
Back
Top