control of validity on a checkbox

Durand
Member Posts: 61
Hello, I look for an information concerning a control of validity on a checkbox (on form). Indeed,
OnDeactivateForm()
IF ("Budget saisi"<>TRUE) AND
("Planning de facturation"<>TRUE) AND
("Plan généré"<>TRUE) THEN
BEGIN
ERROR('Le projet n° %1 n''a pas de budget saisi ou planning de facturation ou de plan généré',"N°");
CurrForm.UPDATE(FALSE); //I use this syntax, but that does not work
END;
I make the test above and I shall wish that the focus returns on one of the checkbox tested. Could you indicate me the solution, thank you.
OnDeactivateForm()
IF ("Budget saisi"<>TRUE) AND
("Planning de facturation"<>TRUE) AND
("Plan généré"<>TRUE) THEN
BEGIN
ERROR('Le projet n° %1 n''a pas de budget saisi ou planning de facturation ou de plan généré',"N°");
CurrForm.UPDATE(FALSE); //I use this syntax, but that does not work
END;
I make the test above and I shall wish that the focus returns on one of the checkbox tested. Could you indicate me the solution, thank you.
0
Comments
-
Most form triggers will close the form if there is an error - you could move your code to the OnQueryCloseForm trigger. This will not prevent deactivation but it will at least prevent the closing of the form. You will not need the CurrForm.UPDATE portion, as the control focus will be on the last control entered by the user.
Hope this is of some use to you.
Rick
[This message has been edited by goofyfish (edited 18-07-2001).]0 -
First some words about propper coding:
The statement:
IF ("Budget saisi"<>TRUE) THEN
can be replaced by
If Not "Budget saisi"
as the variable "Budget saisi" by itselfes is already a boolean variable containing a TRUE or FALSE.
Therefore:
("Budget saisi"<>TRUE)
is equal to
("Budget saisi"=FALSE)
or
(NOT "Budget saisi")
According to the tautologies of De Morgan you can therefore replace:
IF ("Budget saisi"<>TRUE) AND
("Planning de facturation"<>TRUE) AND
("Plan généré"<>TRUE) THEN
with
if Not (
("budget saisi" or "Planning de facturation" or "Plan généré")
) then
If you issue an ERROR, all following statements will never be executed as the ERROR breaks all further processing.
Therefore you might replace the ERROR with a MESSAGE in order to continue the processing. Thus:
IF NOT (
("budget saisi" or "Planning de facturation" or "Plan généré")
) then Begin
MESSAGE('Le projet n° %1 n''a pas de budget saisi ou planning de facturation ou de plan généré',"N°");
CurrForm.UPDATE(FALSE);
END;
With best regards from Switzerland
Marcus FabianWith best regards from Switzerland
Marcus Fabian0
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