"Too many key fields were specified"

Hi All,

I need to get record from table but not with key that is first defined like a primary key, then with second one that is defined. (because I have the fields from second key)

In order do that ,I done this:

Record.SETCURRENTKEY(Record.Type,Record.“No.”)

IF Record.GET(Record.Type::Item,Item.“No.”) THEN BEGIN …

But when I am runing, this kind of msg appears:


Microsoft Dynamics NAV Classic


"Too many key fields were specified, so Record could not be retrieved. The number of fields in the primary key is 1."

If I delete second line (with Get) this error doesn’t occurs.

Would U tell me what is reason for this error and where I am doing mistake.

Thanks in advance

You need to SETRANGE or SETFILTER to get the records not GET…