problems with code fields

I’ve a problem with code fields. i want to put a relation between the field and its value like " Type = type::item “. If I try this with a field that contains codes as the value, I get the answer " code fields can have a length of 2 characters>”. I guess they can have a length of 10. What is wrong? And how to get a solution?

Use CASE to select the action depending on the value of the code field. For example: CASE myField OF 1: DoSomething; 2: DoSomethingElse; John

Aurelie, Option fields are held internally as an integer with the first option in the option string equating to zero. From your example, it looks like you are comparing the two values so either you need the left hand side of the equals to have an identical option string to the right hand side or you need the left hand side to be an integer. If you want to compare a text string to an option then you can do it with: IF TextString = FORMAT(OptionField::AnOption) THEN … Cheers, John