Error message "The expresion Code cannot be type-conver

fmhiguefmhigue Member Posts: 290
edited 2005-09-30 in Navision Attain
Error message "The expresion Code cannot be type-converted to a Option Value"

This is the code I got:


SalesHeader.GET("Tax Area Code");
IF SalesHeader."Tax Area Code" = '0000000000' THEN
BEGIN

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    The key of the Salesheader table is ("Document Type", "No.");

    So there should be something like
    SalesHeader.GET(SalesHeader."Document Type"::Invoice, "Tax Code")
    
  • DenSterDenSter Member Posts: 8,307
    Just to elaborate: The cause of the error is that you are passing the value '0000000000' into the first field of the primary key. The first field of the primary key of the sales header table is the Document Type field, which is an option type field. Navision can't resolve the code type value '0000000000' into the option field, which internally is represented by an integer value, and will consequently throw the error that you are experiencing.

    Other than that, listen to Mark, he knows what he is talking about :)
Sign In or Register to comment.