Yes the code I posted is working so far. If I run ?Test1("PRICE2",1) in the immediate window i get the correct result (PRICE2 is a table in my Database). However, I want to use a SQL query to call the function and do the calculation:
SELECT PRICE2.ID, Test1("PRICE2",1) AS MDiff
FROM PRICE2...