Illegal function call - (%ERR_ILLEGALFUNCTIONCALL) - This is a catch-all error related to passing an inappropriate argument to some statement or function.
There are many things that can cause an Error 5, for example:
Attempting to use the WIDTH# statement on a
The run-time execution of a LET, LET (with Objects), LET (with Types), LET (with Variants), or OBJECT statement failed (see OBJRESULT and OBJRESULT$ to obtain an extended error code).