OnFormat error in Sales Line

bluecat1972
Member Posts: 14
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;
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
-
Works for me and your's isn't so different.
Is the missing ; after TRUE in your code just a post typo?OnFormat(VAR Text : Text[1024];) IF "Unit Price" = 0 THEN BEGIN CurrForm."Unit Price".UPDATEFORECOLOR(255); CurrForm."Unit Price".UPDATEFONTBOLD(TRUE); END;
I assume those are custom booleans - when do they get assigned a value?
perhaps that's your prob?0 -
May be that you just overlooked the trigger name and you pass the code into another trigger that you want? I made this mistake many times... ;-)
And yes, there is missing one semicolon...0 -
Thanks for your help - I actually put the wrong field name in. It should have been "List Price" - in this case, "Unit Price" is the customer price and "List Price" is the MSRP. We're trying to flag the line if the list price or our discount is not the same as the item card.
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.0 -
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...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.
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]0 -
OK, thanks, that did the trick - my field was not registering as a control. Fixing that fixed everything.0
-
I've solved it with her doing a remote desktop session.
The problem was that the text field did not have a control name.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions