Re: CSV Export: Force Trailing Comma?



"PCD" <notmy@xxxxxxxxx> wrote in
news:InlVf.17814$S25.16819@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:

Why didn't you advise the OP to write one field at a time to
his CSV file? You thought that was the correct way to export a
couple of hundred thousand records to Excel!!


Look, Pretty Crappy Developer (PCD), I offered a solution that
met all the constraints.It's not the fastest, but it would work.
Code which satisfies customer requirements without errors is
always the correct way.

It's also obvious to me that you lack the knowledge that you can
write field by field to Excel when the transferSpreadsheet
method fails.

Let us see some code for your solution which would properly
execute writing a single recordset to multiple Excel worksheets.

As for your suggestion in this thread, it has a bug.
If the export specification requires a text qualifier
RevisedLastField:[LastFieldname] & ","
returns "PCD messed up," instead of "PCD messed up",

Put your money where your mouth is.



"Bob Quintal" <rquintal@xxxxxxxxxxxx> wrote in message
news:Xns9791B3AF38F2EBQuintal@xxxxxxxxxxxxxxxxx
bonehead <sendmenospam@xxxxxxxx> wrote in
news:e04c95$n74$1@xxxxxxxxxxxxxxx:

Greetings,

I'm using the DoCmd.TransferText method to export the
results of a MS Access query to a csv file. The csv will
then be used to load an Oracle table.

In other systems such as TOAD for Oracle, it's possible to
force an additional comma delimiter after the last column,
if the column is empty on a particular row. Oracle requires
this additional comma on empty rightmost columns, for
importing purposes.

I am unable to see how to do this in the Visual Basic
TransferText method, or in the MS Access export
specifications.

Can this be done in VB/Access, and how?

Access always puts the correct number of commas. If you need
an additional comma at the end of every row, add null as the
expression for the calculated rightmost field in the query.


--
Bob Quintal

PA is y I've altered my email address.






--
Bob Quintal

PA is y I've altered my email address.
.



Relevant Pages

  • Re: Reading a *.csv file into a combo box
    ... First of all a .csv file is not an 'excel' file. ... There is a method of importing comma delimited text files available ...
    (microsoft.public.access.forms)
  • Re: I need help in reading a "messy" CSV file.
    ... replace the Excel spreadsheets. ... If you have hundreds of thousands of records in the CSV file, ... Note how the third record should contain a comma after the word Penn, ... the first character in the next line is a comma. ...
    (microsoft.public.access.externaldata)
  • Re: Send object function with a CSV file
    ... Actually, knowing some basics VBA in Excel, you can output the table with any ... delimiter once you have the code. ... csv file format to email to a client. ... CSV stands for comma separated values. ...
    (microsoft.public.access.macros)
  • Re: TransferText acImportDelim Problem
    ... no problems (except the problems that Excel causes for itself!) but there is ... The problem arises when the csv file has a comma in the middle of it. ... I can easily live with Jons Company Inc.instead of Jons Company, ...
    (microsoft.public.access.externaldata)
  • Re: CSV Export: Force Trailing Comma?
    ... of a MS Access query to a csv file. ... In other systems such as TOAD for Oracle, ... additional comma on empty rightmost columns, ...
    (comp.databases.ms-access)