by Yuening Dai (30 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 12th September 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Saving ADO Recordset to a text file with user-defined requirements such as col/row delimiters is so easy now - use this function with only
'function by setting some of those parameters to Optional to make it more
'flexible and meet your own need. I am just lazy.
Public Sub SaveRecInText(RstPrm As ADODB.Recordset, _
FileSpec As String, RowCount As Long, _
ColDeli As String, RowDeli As String, _
NullRep As String)
'
Dim sBuffer As String
Dim FileNum As Long
'
sBuffer = RstPrm.GetString(adClipString, RowCount, ColDeli, RowDeli, NullRep)
'
'Remove the file first if it exists.
If Len(Dir(FileSpec)) > 0 Then
Kill FileSpec
End If
'
FileNum = FreeFile
Open FileSpec For Binary As FileNum
Put FileNum, , sBuffer
Close FileNum
'
End Sub
No comments have been posted about Saving ADO Recordset to a text file with user-defined requirements such as col/row delimiters is so. Why not be the first to post a comment about Saving ADO Recordset to a text file with user-defined requirements such as col/row delimiters is so.