I'm trying to update the forecolor and bold on the OnFormat trigger for the Unit Price field in the Sales Quote Subform. I've used basically this code for other fields in this form with no problem. With this specific one only, however, I get an error saying that I cannot modify the font in this context. Does anyone have any idea what I could do differently to affect this change? I have not found a solution in any of the many topics about UPDATEFORECOLOR or UPDATEFONTBOLD. Any insight is much appreciated.
Here is my code:
IF "List Price Discrepancy" AND (NOT ("List/Discount Override")) THEN BEGIN
CurrForm."Unit Price".UPDATEFORECOLOR(255);
CurrForm."Unit Price".UPDATEFONTBOLD(TRUE)
END;
0
Answers
Is the missing ; after TRUE in your code just a post typo?
I assume those are custom booleans - when do they get assigned a value?
perhaps that's your prob?
http://www.BiloBeauty.com
http://www.autismspeaks.org
And yes, there is missing one semicolon...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Interestingly, now that I've got the correct field name, I'm still getting an error. Now it says that I've specified an unknown variable "List Price" and to define it in the globals. But it's definitely part of my table.
IF "List Price Discrepancy" AND (NOT ("List/Discount Override")) THEN BEGIN
CurrForm."List Price".UPDATEFORECOLOR(255);
CurrForm."List Price".UPDATEFONTBOLD(TRUE);
END;
As for the missing semi-colon, I was taught to omit it before an ELSE or an END.
Before ELSE yes, before end it is not good practice, because in most cases you forgot to add it there if you enter some new line after it before end... :-) But just my opinion...
One of these points can lead you to solution:
1) Try to select the control name from Symbol Menu (F5)
2) Check the name property of the editbox on your form.
3) Check the control name which is showen in the Trigger name line.
[/code]
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
The problem was that the text field did not have a control name.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n