Validating a field from one of two subforms of a lookup form

bluecat1972bluecat1972 Member Posts: 14
edited 2009-01-23 in Navision Financials
I have a highly customized installation of 2.60B with 5.0SP1 client. I have a custom table called "Bulletin Submittals." I need to validate the PO number, which can be found in the Purchase Line table or, if the PO is closed, the Archived Purchase Line table which is custom. I have a form that is used for the custom Master Equipment List table that has a subform for each table, filtering on the MEL No. and MEL Line No. fields, but I do not have enough forms available in my license to feel comfortable making a new set of forms based on my Bulletin Submittal table to do the same lookup. ](*,)

I have the Bulletin Submittals table looking up the "No. of Purchase Orders List" form on the "PO Number" field. I need to validate the PO Number from the Document No. field in either subform, so from either table. I tried saying on the form that on the OnAfterGetRecord that it would pass the value to a field called "PO Temp Number" in the Master Equipment List table (since that is the master to the "No. of Purchase Orders List"), and then validating that field to the Bulletin Submittals form after returning, but it does not work. This is the 4th or 5th different way I've tried to pull this information with no luck.

The code is as follows:

On the Bulletin Submittals table:
PO Number - OnLookup()
MEL.SETRANGE("Mel No.","MEL No.");
MEL.SETRANGE("Line Number","MEL Line No.");
IF FORM.RUNMODAL(50018,MEL) = ACTION::OK THEN
VALIDATE("PO No.",MEL."PO Number Temp")
ELSE
CLEAR("PO No.");

On the "No. of Purchase Orders List" form I added the code to the subform, Purchase Lines:

Form - OnAfterGetRecord()
MEL.SETRANGE("Mel No.","MEL No.");
MEL.SETRANGE("Line Number","MEL Line No.");
MEL.VALIDATE("PO Number Temp","Document No.");

This is definitely a more complex issue that I usually get involved in, and I suspect that I'm putting code on the wrong triggers, but I'm just not seeing it. Any help is appreciated, thanks! :)

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi,

    You will need to declare a variable type form for form 50018 e.g. MELList
    Then use
    MELList.SETTABLEVIEW( MEL );
    MELList.LOOKUPMODE := TRUE;
    IF MELList.RUNMODAL  = ACTION::OK THEN
       BEGIN
          MELList.GETRECORD( MEL );
          VALIDATE("PO No.",MEL."PO Number Temp");
       END
    ELSE
    ....
    
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.