Printing Last 2 digits of a Decimal Field

Hi All, I want to print the last 2 digits of a value field on a cheque and I’m not sure how. To explain, I have a Cheque value for £333333.99 and want to show the pence in a seperate field on the cheque so somehow I need to ignore evrything to left of the decimal point so that my field on the Cheque called PenceText (defined as Text) contains only 99 I know it can be done but dont know how. Please advise with a coding example. Thanks

Paul, just my first idea… take the cheque amount, deduct the “integer” part and multiply the decimal part with 100 to obtain 99… then place this variable into the new textbox. PenceText := FORMAT(CheckAmount - ROUND(CheckValue,1,'<')) * 100) Saludos Nils

That is fairly easy: Pounds := ROUND(CheckValue,1,'<'); PoundsString := Format(Pounds,0); PenceString := Format(ROUND(Checkvalue-Pounds*100,1),0);

Nils, you are just too fast for me.

uhhh, that was close… just 49 seconds - in the end, Paul will get 2 valid answers to choose from…

Hi Guys, all working now. Thanks for your invaluable help…Paul

quote:

I would just like to know how I should define Pounds, PoundsString and PenceString in Globals as I get an answer of 1 instead of 99 when I print the cheque.

Quote taken from a mail as Paul could not reply to the topic. OK, Paul, here goes the answer: Pounds: Integer PoundsString: Text 30 PenceString: Text 30 and I just saw that I forgot to set brackets properly (and so did Nils): so the code again: Pounds := ROUND(CheckValue,1,'<'); PoundsString := Format(Pounds,0); PenceString := Format(ROUND((Checkvalue-Pounds)*100,1),0);

Or simply use the FORMAT function: FORMAT(value,0,’’) (If necessary, remove the decimals-separator with a DELCHR)

Even easier, thanks Joerg…Paul