Quote:
JavaScript Runtime Error: Couldn't set Value property of Reference that undefined or null
The message means that for some reason the variable do not contain the expected object.
Use the debugger to see exactly what is wrong.
I think you will have to add code to check if the variable is not NULL.