Hi
Please treat me with sympathy. I'm a complete novice.
Another user on this forum very kindly gave me some code to assist me with creating a field in a query that generates a sequence of numbers based on time/date fields in the same query.
However it doesnt stop when it gets to the end of the records. As soon as I scroll from left to right and back again in datasheet view, the values start not from 1, but from the number of records+1.
Is there a way I can make it static so that I could refer to this value in another query or report?
Please help...
The code is:
Option Compare Database
Option Explicit
Dim mlngCounter As Long
Function ResetCounter()
mlngCounter = 0
End Function
Function GetNextCounter(pvar As Variant) As Long
mlngCounter = mlngCounter + 1
GetNextCounter = mlngCounter
End Function
Any help is appreciated. Thanks in advance.
Please treat me with sympathy. I'm a complete novice.
Another user on this forum very kindly gave me some code to assist me with creating a field in a query that generates a sequence of numbers based on time/date fields in the same query.
However it doesnt stop when it gets to the end of the records. As soon as I scroll from left to right and back again in datasheet view, the values start not from 1, but from the number of records+1.
Is there a way I can make it static so that I could refer to this value in another query or report?
Please help...
The code is:
Option Compare Database
Option Explicit
Dim mlngCounter As Long
Function ResetCounter()
mlngCounter = 0
End Function
Function GetNextCounter(pvar As Variant) As Long
mlngCounter = mlngCounter + 1
GetNextCounter = mlngCounter
End Function
Any help is appreciated. Thanks in advance.