A Field or a Variable of the <type> Type is Expected for the Parameter Passed by Reference

Description

The type's member signature contains parameters declared using the Var keyword. When a type member is invoked, an object that is neither a variable nor a class field has been specified as a parameter value.

Troubleshooting Tips

Check invocation syntax. Variables or class fields should be specified as values of the parameters declared using the Var keyword.

Example

Sub Test(a: Integer; Var b: Integer);
Begin
    
End Sub Test;

Sub UserProc;
Begin
    Test(12);
End Sub UserProc;

When the specified code is compiled, the string Test(1, 2); displays the following error: A field or an Integer variable is expected for the parameter passed by reference. To resolve the error, declare an integer variable in the procedure and specify this variable as the second parameter for the invocation of the Test procedure.

See also:

Compiler Messages