Changing the color of a memo as a query value changes

The master data band displays rows from a query. One of the values is a client #. There can be a single or multiple rows for a client #. I would like to change the color of the row (each memo) when the client # changes. The client # is not the group heading. I know how to alternate colors on each row.
I???ve tried some code:
var
  clienthold: String;    
begin                                                       
  if clienthold <> MemoClient.lines.text then begin //MemoClient contains the client #                                                                                 
       clienthold:= MemoClient.lines.text;
       Memo2.Color := clRed;  
  end;
end;

Assuming that code works, in what event should I place it?
Is that the wrong approach? Any suggestions?
The report is attached.
Thanks

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:42AM
    try the onafterdata event of the memo
  • edited January 2014
    I had tried the onafterdata event of the memo but had a flaw in my logic. I now have the code setting the color back to its
    original when it changes again. I also had to deal with the first row. It's easier to get the code right once you've decided where to put it.
    I got it now.
    Thanks.

    Edit: The onafterdata event was the place to put it.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.