I would like to write some custom VBA functions to perform calculations on particular fields in a set of queries. This is what I currently have:
Public Function TVM(LEN_SEC As Double, ADT_CUR As Integer, TRK_PCT As Integer)
TVM = LEN_SEC * ADT_CUR * TRK_PCT / 100#
End Function
This works fine, but when I create the query I have to do something like this:
SELECT TVM([LEN_SEC], [ADT_CUR], [TRK_PCT]) AS TRK_VMT
FROM System;
I would prefer to do this instead:
SELECT TVM()
FROM System;
Is there a way to access the current row being output by the query from within the VBA function? Something like this:
Public Function TVM(LEN_SEC As Double, ADT_CUR As Integer, TRK_PCT As Integer)
TVM = CurrentRow.Fields("LEN_SEC") * CurrentRow.Fields("ADT_CUR") * CurrentRow.Fields("TRK_PCT") / 100#
End Function
These calculations are frequently used in time-sensitive custom generated reports, by several users of varying skill level and attention spans - the simpler I can make the interface for them, the better it is for our QA team.
Thanks!