I have this function which exports to CSV
Function RecordsetToCSV(ByRef RS, ByVal CSVFilePath, ByVal IncludeFieldNames)
Set objCSVFile = CreateObject("ADODB.Stream")
If IncludeFieldNames Then
'string concatenation issues aren't a problem for a small string of field names
For Each Field In RS.Fields
If FieldNames = doublequote Then
FieldNames = Field.Name
FieldNames = FieldNames & "," & Field.Name
FieldNames = FieldNames & vbCRLF
Call objCSVFile.WriteText(FieldNames, 1)
Call objCSVFile.WriteText(FieldNames & RS.GetString(adClipString, , ",", vbCRLF, doublequote))
Call objCSVFile.SaveToFile(CSVFilePath, 2)
Set objCSVFile = Nothing
But when i enter the values for the third argument i get an error.
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'IncludeFieldNames'
/transactadmin.asp, line 8
I am obviously doing something wrong. Can someone show me how they think this function should be called.