Isn't this a bit like phoning the doctor and asking 'Doc, what's wrong with
me?'
Even your description - the code always returns 0, could refer to a
calculation within your code rather than your code itself.
Here's a just couple of things which don't show up in Debug, just to get you
started.
If the code runs within a form or report your code may refer to the contents
of a parent or subform form and you have the wrong name for the parent form
or the wrong name for the control within the subform.
You are trying to perform a calculation which involves a field which may
sometimes contain null or you have NZ'd a null field so that it appears to
contain numbers but actually contains text values (the field appears left,
instead of right-aligned unless you specifically format it to left-align).
Evi