Where did you put the function? It needs to be in a module (not a class
module, nor the class associated with a form), and the module cannot be
named ReturnMonthTotal (module names cannot be the same as sub or function
names).
And just to make sure, are you running the query from within Access, or are
you running it from outside of Access (say through a web page, or a VB
program)? It won't work unless you're running within Access.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> BeWyched,
>
[quoted text clipped - 30 lines]
>
> Steven
Steven - 08 Mar 2007 20:00 GMT
Douglas,
Thank you for your response.
Everything is from within access. I have a select query that has a source
of a table with fields Co, Account, Year, 01, 02, 03 .......12. I did it
this way because for one record in the budget I wanted to post by month.
Typically I would set up a Field called Month and then records would be 01,
02 ...12 but in this case I wanted the fields to be individual months. Now
.. on the form the user will pick a StartMonth and and EndMonth. So for
example ; if the user picks StartMonth 04 and EndMonth 07 then the formula
in the query for a total field would be Total: [04] + [05] + [06] + [07] .
Originally I was thinking I could return a formula to the Total: ______ in
the query and use a function to create which months to include. Note: The
module is just named Module10.
Thank you,
Steven
Sorry Steven
The final lne of code should read:
ReturnMonthTotal = RunningTot
and NOT
ReturnMonthTot = RunningTot
Cheers.
BW
> BeWyched,
>
[quoted text clipped - 30 lines]
>
> Steven
Steven - 08 Mar 2007 19:25 GMT
BeWyched,
It gives me an "External name not defined on the Ar(1):
Ar(1) = [tblBudget].[01].Value
and highlights: [tblBudget]
Thank you,
Steven