Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export to CSV with All fields Quoted

Status
Not open for further replies.

mustangjs

IS-IT--Management
Dec 6, 2002
1
US
Is there a way to export to CSV and have all fields Quoted?

I.E.
"Last", "First", "department#", "title", "Status"
"Jones", "James", "12345", "Programmer", "A"
"Smith", "Mary", "12321", "Director", "A"
"Johnson", "Harry", "54321", "Maid" "T"

The regular export only does the commas, not the quotes.

- Bill
 
You could do a macro.

Sub CREATE_FILE()

Rem File name to be used
FileName = "C:\somefile.TXT"

Rem Get the next free file number, this is used for file I/O
FileNumber = FreeFile

Rem If the file is found delete it
If Dir(FileName) <> &quot;&quot; Then Kill FileName

Rem Open the file for output lock the file while it is open
Open FileName For Output Access Write Lock Read Write As FileNumber

Rem Get the first record in the report
GetRandom 1

Rem Loop through all of the records in the report
For i = 1 to TotalRecords()

Rem Write the record to the file
Write #FileNumber,Field(&quot;SomeField1&quot;)+&quot;,&quot;+Field(&quot;SomeField2&quot;)

Rem Get the next record
GetNext

Rem Loop
Next i

MsgBox &quot;File Created&quot;

End Sub CharlesCook.com
ADP - PeopleSoft - SAP
ReportSmith - Crystal Reports - SQR - Query - Access
Reporting - Interfaces - Data Mining
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top