Mika,

Greg's advice is right about OnChange getting called a lot. It may get called before the object is activated or it may even get called before all of the other objects are created. An alternate way to test this is to check if the object is active. It is possible that you could have this same issue when focus has already been set somewhere so Active_State might provide a better test.

Code:
 Procedure OnChange
    Boolean bActive
    Get Active_State to bActive
    Forward Send OnChange
    If bActive Send SetYear
End_Procedure
The Datasource object is not initialized until the grid is activated and you definitely do not want to send messages to the datasource before activation. You also should not send navigation messages like MoveToFirstRow when the grid is not active. Apart from there being no data in the datasource, any COM message sent will result in an error.

-John