Mandatory field - OnNextRecord & OnQueryCloseFo

hairyjimhairyjim Member Posts: 99
edited 2005-11-23 in Navision Attain
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
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.

Comments

  • hairyjimhairyjim Member Posts: 99
    Great:

    I used this code in the OnAfterGetRecord method, works a charm

    IF ("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.
  • allenmanallenman Member Posts: 37
    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
    SteveA
  • hairyjimhairyjim Member Posts: 99
    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.
  • allenmanallenman Member Posts: 37
    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?
  • hairyjimhairyjim Member Posts: 99
    It fails in both production server and live server
    Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.
Sign In or Register to comment.