Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub cmdExport_Click()
On Error GoTo ErrHandler
Dim rs As ADODB.Recordset
Dim strSql As String
Const SW_SHOWNORMAL = 1
'Clear the text file
Open ExportPath For Output As #1
Print #1, ""
Close #1
If lstPersonnel.SelCount = 0 Then 'Get all records
iRow = 1
For i = 0 To lstPersonnel.ListCount - 1
strSql = "EXEC spCFD_CJAC_Export @dStartDate = '" & dtpStartDate.Value & _
"', @dEndDate = '" & dtpEndDate.Value & "', @iCityIDNum = " _
& lstPersonnel.ItemData(i)
Set rs = GetADORSP(strSql)
Open ExportPath For Append As #1
Do While Not rs.eof
Print #1, rs.GetString(, , "|", vbCrLf, "");
Loop
Close #1
Set rs = Nothing
Next i
Print #1, ""
Close #1
Open ExportPath For Append As #1
Print #1, rs.GetString(, , "|", vbCrLf, "")
Close #1
'assuming an open recordset rs with 3 fields
dim fso as filesystemobject
dim ts as textstream
set fso = new filesystemobject
set ts = fso.opentextfile("somefilename")
with rs
.movefirst
do until .eof
ts.writeline .fields(0) & ", " & .fields(1) & ", " & .fields(2)
.movenext
loop
.close
end with
ts.close
Set oStream = FSO.CreateTextFile("C:\LoopingBy[!]10[/!].txt", True)
sStart = Timer
While Not RS.EOF
Call oStream.Write(RS.GetString(adClipString, [!]10[/!], "|", vbCrLf))
Wend
oStream.Close
lblLoopBy[!]10[/!].Caption = "Loop By [!]10[/!] Method: " & Timer - sStart
RS.MoveFirst