Declare Variables


Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.


This code segment declares all the (global) variables for the script, because the script doesn't contain any Sub or Function procedures with local variables. Although it is optional to declare variables before you use them in VBScript, it is good programming practice to use the Option Explicit statement and to declare variables that the script uses.

Option Explicit
Dim strGroupBy          ' Name of GroupBy column.
Dim intI, intJ          ' Index variables.
Dim objQ                ' Query object.
Dim strRecord           ' Output record of query results.
Dim objRS_Child         ' Child Recordset object.
Dim objRS_Parent        ' Parent Recordset object.
Dim intRS_Child_Count   ' Number of current record of child Recordset.
Dim intRS_Parent_Count  ' Number of current record of parent Recordset.
Dim objU                ' Utility object.