ValidateCity(VAR City : Text[30];VAR PostCode : Code[20]) IF NOT GUIALLOWED THEN EXIT; IF City <> '' THEN BEGIN SearchCity := City; PostCodeRec.SETCURRENTKEY("Search City"); PostCodeRec.SETFILTER("Search City",SearchCity); IF NOT PostCodeRec.FIND('-') THEN EXIT; PostCodeRec2.COPY(PostCodeRec); IF PostCodeRec2.NEXT = 1 THEN IF FORM.RUNMODAL(FORM::"Post Codes",PostCodeRec,PostCodeRec.Code) <> ACTION::LookupOK THEN EXIT; PostCode := PostCodeRec.Code; City := PostCodeRec.City; END;
Comments
This code checks if there is more than 1 city in the post code table and if so displays the list of cities with the criteria you have entered.
Regards
Albert
PostCodeCheck.AddressValIsPostCodeCity;
now it works, but I'm still curious... :?
Alberth, how about if the city is the last record in the list (means that NEXT = 0)?
That is correct
Then the last record in the list won't open the form modal.
You have pointed it well. A good trick from the programmer.
Thanks a lot JReynolds! =D>
Jemmy