...
BEGIN
IF Cont.GET(GETFILTER("Contact Company No.")) THEN
CaptionStr := COPYSTR(Cont."No." + ' ' + Cont.Name,1,MAXSTRLEN(CaptionStr));
// Delete the following lines.
IF Cont.GET(GETFILTER("Contact No.")) THEN
CaptionStr := COPYSTR(CaptionStr + ' ' + Cont."No." + ' ' + Cont.Name,1,MAXSTRLEN(CaptionStr));
// End of the lines.
IF SalesPurchPerson.GET(GETFILTER("Salesperson Code")) THEN
CaptionStr := COPYSTR(CaptionStr + ' ' + SalesPurchPerson.Code + ' ' + SalesPurchPerson.Name,1,MAXSTRLEN(CaptionStr));
IF Team.GET(GETFILTER("Team Code")) THEN
CaptionStr := COPYSTR(CaptionStr + ' ' + Team.Code + ' ' + Team.Name,1,MAXSTRLEN(CaptionStr));
...
...
BEGIN
IF Cont.GET(GETFILTER("Contact Company No.")) THEN
CaptionStr := COPYSTR(Cont."No." + ' ' + Cont.Name,1,MAXSTRLEN(CaptionStr));
// Add the following lines.
IF Cont.GET(GETFILTER("Contact No.")) THEN BEGIN
Cont1.GET(GETFILTER("Contact Company No."));
IF NOT(Cont1."No." = Cont."No.") THEN
CaptionStr := COPYSTR(CaptionStr + ' ' + Cont."No." + ' ' + Cont.Name,1,MAXSTRLEN(CaptionStr));
END;
// End of the lines.
IF SalesPurchPerson.GET(GETFILTER("Salesperson Code")) THEN
CaptionStr := COPYSTR(CaptionStr + ' ' + SalesPurchPerson.Code + ' ' + SalesPurchPerson.Name,1,MAXSTRLEN(CaptionStr));
IF Team.GET(GETFILTER("Team Code")) THEN
CaptionStr := COPYSTR(CaptionStr + ' ' + Team.Code + ' ' + Team.Name,1,MAXSTRLEN(CaptionStr));
...