Solved

Write data from SQL to CSV file - position

Posted on 2016-08-25
1
59 Views
Last Modified: 2016-08-31
I am trying to create a sub to write fixed lenght to cvs file. Could you help? Max lenght per line is 500.

    Public Sub ExportOrderData()
        Using MyFile1 As New StreamWriter("C:\Temp\MyFile.csv")
         
           position 10 - 15 = write Order #
           position 17 - 25 = write Description
           position 30 - 100 = write Address  

           max size per line is 150


        End Using
    End Sub
0
Comment
Question by:jagr12
1 Comment
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 41771106
Hi  jagr12;

You can use the String.Format Method which will allow you to give field a width value for each specific line position, spaces between columns, how to justify the data in the field and many other options, Have a look at the Microsoft documentation String.Format Method.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question