query results to a .txt file ?

Posted on 2007-08-09
Last Modified: 2010-04-30
How can I write query results to a .txt file WITHOUT quotes wrapping around them?


rs.Open "SELECT left(ssn,6) & space(6-len(left(ssn,6))) & space(44) & 'E' & space(11) & format(Hours,'00000.00') & space(12) & format(commission,'000000.00') & space(38) as PayChex FROM Payroll"
    Open "C:\Program Files\Helios11\BonusCommish.txt" For Append As #1
                    Do Until rs.EOF = True
                    If rs("Paychex") <> "" Then
                        thePayChex = rs("Paychex")
                                Write #1, _
                      End If
            Close #1


"2115                                              E           00079.95            000165.27                                      "
"2090                                              E           00026.49            000089.24                                      "
"2170                                              E           00055.41            000150.58                                      "
"2202                                              E           00031.04            000129.07                                      "
"2213                                              E           00024.44            000000.74                                      "
"1027                                              E           00076.51            000186.53                                      "

Question by:Ahelbling
    1 Comment
    LVL 38

    Accepted Solution

    Instead of

    Write #1, _


    Print #1, thePayChex

    No quotes should be embedded this way.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    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…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    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…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now