views:

31

answers:

2
//Using Small Business Code from PO Record in Subreport Accumulate Associated $
numbervar BC1;
WhilePrintingRecords;
shared stringvar BC;
// added following 2 statements to prevent doubling value on last record 10/23/06 (WET)
if shared stringvar BC = "   BC1" and not onlastrecord then BC1 := BC1+{@PTEXT$};
if shared stringvar BC = "   BC1" and onlastrecord then BC1 := BC1+{@PTEXT$}/2;
// deleted following statement to prevent doubling value on last record 10/23/06 (WET)
// if shared stringvar BC = "   BC1" then BC1TOT := BC1TOT+{@PEXT$};
BC1

I'm getting an error in the BC1+{@PTEXT$}; that states "A number is required here." On another copy of a crystal reports form, I have the same code, but no error. Any Ideas here?

+1  A: 

It looks like you are combining a number with text. You must Convert BC1 to text or the text to a number if possible.

John Hartsock
Not quite, PTEXT is a numberic value based off a calculation. Im attempting to show the amount of a number value. BC1 BC2, BC3, etc. depending on how many show up in the report, will show some sort of money value.
gabrielVa
@gabrielVA well the error your getting tell me that PTEXT is being translated as STRING. Just for giggles convert it to number and see what happens.
John Hartsock
A: 
  1. BC1+{@PTEXT$} cannot be added if {@PTEXT$} is a string (if {@PTEXT$}=" 1", Crystal may recognize that as a string, not a number). You could change that to cdbl(BC1+{@PTEXT$})

  2. Perhaps you have a record for which {@PTEXT$} is null? Since BC1+null=null, that could be a problem.

PowerUser