I've fix it now. I've used CStr() function instead of CLng,Val or CInt since varchar is used in the original script.