Article ID: 207651
Article Last Modified on 6/24/2004
Option Explicit Global Cntr As Integer
'*************************************************************
' Function: NthRec(Z As String, Nth As Integer) As String
'
' Purpose: This function will return an "X" to the query for
' every Nth record as specified by the parameter in the query.
'*************************************************************
Function NthRec(Z As String, Nth As Integer) As String
Cntr = Cntr + 1
If Cntr Mod Nth = 0 Then
NthRec = "X"
End If
End Function
'**************************************************************
' Function: SetToZero()
'
' Purpose: This function will reset the global Cntr to 0. This
' function should be called each time before running a query
' containing the Qcntr() function.
'**************************************************************
Function SetToZero()
Cntr = 0
End Function
'**************************************************************
' Function: RunNthQuery()
'
' Purpose: This function runs the SetToZero function and then
' opens the qryEveryNthRecord query in Datasheet view.
'**************************************************************
Function RunNthQuery()
SetToZero
DoCmd.OpenQuery "qryEveryNthRecord"
End Function
Query: qryEveryNthRecord ----------------------------- Type: Select Query Field: OrderID Table: Orders Field: CustomerID Table: Orders Field: OrderDate Table: Orders Field: Freight Table: Orders Field: NthRec([OrderID],[What Nth Would You Like Today?]) Show: No Criteria: X
?RunNthQuery()
Keywords: kbhowto KB207651