It doesn't look like you have the name of your function there. Shouldn't it
be
HoursAndMinutes: MyFunction([Timeout]-[Timein]) ?
Where "HoursAndMinutes" is the name of your calculated field, "MyFunction"
is the name of your Function (Note it has to be a function, not a subroutine
as you mentioned in your original post), and "[TimeOut]-[Timein]" the
argument you are passing to your functions.
Michelle said:
I'm trying to calculate elapsed time in a query in my Access database. I
copied the Microsoft code in a module and tried to call from query.
HoursAndMinutes: ([Timeout]-[Timein])
It wants to treat this as a variable and never calls the function.
Klatuu said:
Yes. The function must be a Public Function in a standard module. You
use a
calculated control to return the results of the query.
ConvertedValue: MyFunction([SomeField])
--
Dave Hargis, Microsoft Access MVP
:
Can I call a VBA subroutine from within an Access query? I wrote some
English
to Metric conversion routines in the Access VBA code and would like to
run a
query on the data that will return coverted values. I need to be able
to
execute this from outside the database (run the query from another
program).