DBlank is correct (it's his solution afterall)
but you could easily have 1 formula like:
shared stringvar sLeft;
shared stringvar sMid;
shared stringvar sRight;
local numbervar i = instr({table.field}, "text desired");
local numbervar ii;
if i= 0 then( //not found
sLeft := {table.field};
sMid := "";
sRight := "";
)
else(
sLeft := LEFT({table.field}, i -1);
ii = INSTR(i+1, {table.field}, ',");
if ii = 0 then ii := LEN({table.field}) + 1;
sMid := MID({table.field}, i, ii - i);
sRight := MID({table.field}, ii);
)
"" //hides the output
then you would need 3 access formulas to print each of the shared variables in the textbox with the one accessing sMid to be underlined.
I did get this correct DBlank, didn't I? Or do you have another method.
If there are multiple sections of the code that will be underlined, well that would make for a much more complex formula. In addition, if you want to back up to the comma prior to the selected text, you would need call to instrrev.
I am pretty sure that I covered a basic scenario
HTH