troubleshooting Question

Integrate Export Function

Avatar of REA_ANDREW
REA_ANDREWFlag for United Kingdom of Great Britain and Northern Ireland asked on
26 Comments1 Solution488 ViewsLast Modified:

I have this function which exports to CSV

Function RecordsetToCSV(ByRef RS, ByVal CSVFilePath, ByVal IncludeFieldNames)
      Set objCSVFile = CreateObject("ADODB.Stream")
      Call objCSVFile.Open

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
End If

FieldNames = FieldNames & vbCRLF
Call objCSVFile.WriteText(FieldNames, 1)
End If

Call objCSVFile.WriteText(FieldNames & RS.GetString(adClipString, , ",", vbCRLF, doublequote))
Call objCSVFile.SaveToFile(CSVFilePath, 2)
Set objCSVFile = Nothing
End Function

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.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 26 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 26 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros