'get a recordset that contains the ANIs to maintain and their associated CustomerIDs as well as the SSN2
strSQL = "SELECT tblSprintBatchMaint.UserId, tblSprintCustId_NPA.CustomerID, tblSprintCustId_NPA.SSN2 " & _
"FROM tblSprintBatchMaint, tblSprintCustId_NPA " & _
"WHERE ((tblSprintCustId_NPA.City)=Left(tblSprintBatchMaint.UserId,3)); "
Set rs = db.OpenRecordset(strSQL)
rs.MoveLast
rs.MoveFirst
'set the header and footer values
strHeader = txtCompName & vbCrLf & txtSSN2 & vbCrLf & txtBatchNo & " " & rs.RecordCount & vbCrLf & txtFileType & vbCrLf & txtEmail & vbCrLf
strFooter = "DOWNLOADSS"
'prepare a file for output
Open ("C:\Documents and Settings\" & Environ("username") & "\My Documents\SprintBlockAni_" & strFileDate & ".txt") For Output As #1
Print #1, strHeader
For rc = 1 To rs.RecordCount
Print #1, rs!userid & rs!CustomerID & rs!SSN2
rs.MoveNext
Next rc
Print #1, strFooter
Close #1