Sure Fitz,
Once you get the hang of using a UDF, you will love them (at least I do).
Insert the code in a standard module (alt+F11, insert|module, double click on the new module and insert paste in the code)
What you've done is make yourself a new formula, called FXhours(). It has four arguments, Total Hours, monthly, weekly, and daily.
If you use this in a report, you would use it like:
=FXHours([Total Hours], [monthly], [weekly], and [daily]). You would refer to these fields just as you were attempting to in your original formula.
You would replace [Total Hours] with the field in the report or query that contained this data.
To simplify, say you made a UDF (user defined function) that had two arguments. The function is Adder(arg1, arg2).
You might define it like:
Code:
Function Adder(arg1, arg2)
Adder = arg1 + arg2
End Function
And you would use the function like:
Adder(1,5) which would result in 6
or
Adder([field1],[field2]) which would add the data in field1 plus field2
or
Adder([txt1],[txt2]) which would add the number in Txt1 to Txt2.
I'll work it into a db if you need, just send it to
corticus@theofficeexperts.com (all data is confidential)
Its hard to provide a good sample for you without seeing how you intend to use it, but I'm pretty sure this UDF will get the job done for you.
HTH,