I am trying to create a user defined function within Access. I created a new Module (Standard) and placed the following in it:
Function BlockA()
BlockA = _
IIf(CLng(IIf(IsNull([LPICHUSG]![LPANREQ]), 0, [LPICHUSG]![LPANREQ])) = 0, 0, CLng(IIf(IsNull([LPICHUSG]![LPANNONE]), 0, [LPICHUSG]![LPANNONE])) / CLng(IIf(IsNull([LPICHUSG]![LPANREQ]), 0, [LPICHUSG]![LPANREQ])))
End Function
After saving it and creating a test query to make sure it works, it returns an error of "Undefined Function "BlockA" in expression". I built the query by selecting the function from within the Expression Builder.
Can someone give me a hint as to what might be causing this. This is my first attempt at creating a function. I have been using Access for quite a while so it is not neccessarily new to me.
Thanks
Function BlockA()
BlockA = _
IIf(CLng(IIf(IsNull([LPICHUSG]![LPANREQ]), 0, [LPICHUSG]![LPANREQ])) = 0, 0, CLng(IIf(IsNull([LPICHUSG]![LPANNONE]), 0, [LPICHUSG]![LPANNONE])) / CLng(IIf(IsNull([LPICHUSG]![LPANREQ]), 0, [LPICHUSG]![LPANREQ])))
End Function
After saving it and creating a test query to make sure it works, it returns an error of "Undefined Function "BlockA" in expression". I built the query by selecting the function from within the Expression Builder.
Can someone give me a hint as to what might be causing this. This is my first attempt at creating a function. I have been using Access for quite a while so it is not neccessarily new to me.
Thanks