Hi,
I have a query which matches up pairs of Ids from the same table and samefield based on certain criteria. Once a match has been found I can no longer consider those Ids for further pairs. To do this I need to know both of the ids from the prior row.
I have written a module (only stores one Id will duplicate when working for other Id)
Code:
Option Compare Database
Global lastRecalcID As Integer
Public Function getRecalcID(ByVal recalcId As Integer)
getRecalcID = lastRecalcID
lastRecalcID = recalcId
End Function
to return the last value, then store the new value. Works fine when testing in the VBE but when I use it in a query
the results are
lastRecalc RecalcID
16 16
17 17
16 16
17 17
instead of
lastRecalc RecalcID
0 16
16 17
17 16
16 17
The lastvalue and the current value are always the same, and no zero is returned for the first row when I assume lastRecalcID would be uninitialised, any suggestions.
Thanks
Mordja