Mandatory field - OnNextRecord & OnQueryCloseFo

hairyjim
Member Posts: 99
Hi all,
I have a field called status and I need this field to be manadatory (as best navision can do).
Now I can add the following to OnQueryClose and OnNextRecord
This works fine when trying to close the form, but when they try and navigate to a different record it will trigger the OnNextRecord and thus the validation I put in. Problem is the OnNextRecord validation causes the form to close and I do not want the form to close I want the form to remain visible so a user can correct their problem.
How do I do this?
I have a field called status and I need this field to be manadatory (as best navision can do).
Now I can add the following to OnQueryClose and OnNextRecord
IF Status = '' THEN ERROR('Please insert a value into the Call Status field');
This works fine when trying to close the form, but when they try and navigate to a different record it will trigger the OnNextRecord and thus the validation I put in. Problem is the OnNextRecord validation causes the form to close and I do not want the form to close I want the form to remain visible so a user can correct their problem.
How do I do this?
Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.
0
Comments
-
-
Great:
I used this code in the OnAfterGetRecord method, works a charmIF ("No." <> xRec."No.") AND (xRec."No." <> '') THEN BEGIN IF xRec."your field" = '' THEN BEGIN Rec := xRec; xRec.TRANSFERFIELDS(Rec); CurrForm.UPDATE(FALSE); MESSAGE('Your Message'); END; END;
Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0 -
Hello
I found this in a search and have a pratically identical requirement.
When I try this code at the CurrForm.Update(False); line Navision crashes.
Upon re-loading I get a "Recovering list of free blocks" and indicator.
My devlopment work test system is an off line version ie In File/Database/Open Database name is d:\vol1.fdb + d:\vol2.fdb + d:\vol3.fdb.
Is that relevent?
Any one any ideas on this
Regards
SteveA0 -
Sorry I perhaps should have chased this up myself this also happens to my system.
I was not able to solve it, but I also did not ask in here for any advice. Maybe someone can help us both out.Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0 -
Thanks for the reply.
Just to calrify, do you mean that this code failed (as described above) on an off line system but worked when connected to the proper database running from the server?0 -
It fails in both production server and live serverGive a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.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