Dave This reproduces the error
lnFields = 33 lcCode = "" lcCode = "Create Table Test (" For n = 1 To lnFields lcCode = lcCode + "Field" + Transform(n) + " N(2,0)" + Iif(n < lnFields,",",")") EndFor &lccode lcCode = "Calculate " lcFields = "" For n = 1 To lnFields lcCode = lcCode + "Sum(Field" + Transform(n) + ")" + Iif(n < lnFields,",","") lcFields = lcFields + "lnField" + Transform(n) + Iif(n < lnFields,",","") EndFor lcCommand = lcCode + " To " + lcFields &lcCommand It works for lnFields = 32 Paul -----Original Message----- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Dave Crozier Sent: 22 November 2013 13:37 To: profoxt...@leafe.com Subject: RE: Reproduceable C5 error If you modify the for to include a statement i.e "for (.T.=.F.) and (..........)" to exclude all the data does it still throw an error? In which case I'd start to look at the data and overflow possibilities or non numeric content such as fields with "*" where VFP has loaded a default overflow value. Also look at a SQL alternative and populate a data object Dave -----Original Message----- From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Paul Newton Sent: 22 November 2013 13:26 To: profox@leafe.com Subject: Reproduceable C5 error Hi all The following code ALWAYS generates a C5 error: Calculate Sum(NPAYAMNT),Sum(NDUEAMNT),Sum(NEAAMNT),Sum(W3_GRTAX),Sum(W3_STLNDED),Sum(W3_TXCRPD),Sum(W3_NTTAX),Sum(W3_GRNIC),Sum(W3_SSPREC),Sum(W3_SMPREC),Sum(W3_SPPREC),Sum(W3_SAPREC),Sum(W3_NICHOL),Sum(W3_NICDED),Sum(W3_NETNIC),Sum(W3_AMOUNT),Sum(W3_SSPPD),Sum(W3_SMPPD),Sum(W3_SPPPD),Sum(W3_SAPPD),Sum(W3_SMPCOMP),Sum(W3_SPPCOMP),Sum(W3_SAPCOMP),Sum(W3_SMPRERP),Sum(W3_SMPCMRP),Sum(W3_SMPRESP),Sum(W3_SMPCMSP),Sum(W3_ASPPPD),Sum(W3_ASPPREC),Sum(W3_ASPPCOM),Sum(W3_ERNI),Sum(W3_EENI),Sum(STATE) For W3_Year = '1415' And W3_Month = 1 And Not Deleted() To lnNPAYAMNT, lnNDUEAMNT, lnNEAAMNT, lnW3_GRTAX, lnW3_STLNDED, lnW3_TXCRPD, lnW3_NTTAX, lnW3_GRNIC, lnW3_SSPREC, lnW3_SMPREC, lnW3_SPPREC, lnW3_SAPREC, lnW3_NICHOL, lnW3_NICDED, lnW3_NETNIC, lnW3_AMOUNT, lnW3_SSPPD, lnW3_SMPPD, lnW3_SPPPD, lnW3_SAPPD, lnW3_SMPCOMP, lnW3_SPPCOMP, lnW3_SAPCOMP, lnW3_SMPRERP, lnW3_SMPCMRP, lnW3_SMPRESP, lnW3_SMPCMSP, lnW3_ASPPPD, lnW3_ASPPREC, lnW3_ASPPCOM, lnW3_ERNI, lnW3_EENI, lnSTATE Of course, to test it you would need a cursor or table with the fields referred to. The length of the statement is 973 characters so I don't think that is an issue. Ideas? Comments? Many thanks Paul Newton [excessive quoting removed by server] _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/9a8106afb0ef9b44b69045c4448935a20d46d...@nlbawexmbx1.infor.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.