Created a function in module and it works in an update query. But the same query will halt in a macro.