kennedymr2
Programmer
I need to determine the diffence between the current record and the previous record... for one field only.
I see to be able to achieve this using globals. see below.
In my query i do get exactly the result i need., but when i test the field in the query eg 200.. it does not recognise it as a numeric or alpha field..
Appreciate any ideas...
------------------------------------------
Option Compare Database
Global GPH As String
Global GPrevious As Long
Public Function GDifference(GH As String, GD As Long) As Long
If GH <> GPH Then GPrevious = 0
GDifference = 0
If GPrevious > 0 Then GDifference = GD - GPrevious
GPrevious = GD
GPH = GH
End Function
I see to be able to achieve this using globals. see below.
In my query i do get exactly the result i need., but when i test the field in the query eg 200.. it does not recognise it as a numeric or alpha field..
Appreciate any ideas...
------------------------------------------
Option Compare Database
Global GPH As String
Global GPrevious As Long
Public Function GDifference(GH As String, GD As Long) As Long
If GH <> GPH Then GPrevious = 0
GDifference = 0
If GPrevious > 0 Then GDifference = GD - GPrevious
GPrevious = GD
GPH = GH
End Function