troubleshooting Question

Access Query export file

Avatar of aplona
aplonaFlag for United States of America asked on
Microsoft AccessMicrosoft DevelopmentSQL
33 Comments1 Solution533 ViewsLast Modified:
Hello,
    I have this query, which works great but i need it to export to  a txt file and in that txt file remove all the quatation marks and spaces except one space after 'Amount~~'  Here it is:
SELECT
    'Comp Name~~~~~~~~~~~',
    ',',
    'Comp Contact~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' ,
    ',',
    'ID' ,
    ',',
    'Phone Number~~~~~~~~' ,
    ',',
    'Email~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' ,
    ',',
 Referral.Hosp_Discharge_Date,
    ',',
    'Hosp~~~~~~~~~~~~~~~~~~~~~~~~~~~' ,
    ',',
    'HospID~~',
    ',',
 [Contact Info].Medicare_ID& String(12-len([Medicare_ID]), "~"),
    ',',
 [1)ID/Name/Goals].PLstName & String(30-len([PLstName]), "~"),
    ',',
 [1)ID/Name/Goals].PFstName & String(30-len([PFSTName]), "~"),
    ',',
 [Contact Info].Gender,
    ',',
 [Contact Info].Zip & String(10-len([Contact Info.Zip]), "~"),
    ',',
IIf([Hosp_Visit_24]=True,"T","F") AS Hosp_Visit,
    ',',
IIf([In_Home_Within 3]=True,"T","F") AS In_Home_Within,
    ',',
IIf([In_Home_After_3]=True,"T","F") AS In_Home_After,
    ',',
IIf([Tel_Within_1]=True,"T","F") AS Tel_Within,
    ',',
IIf([Tel_After_1]=True,"T","F") AS Tel_After,
    ',',
IIf([Other_Encounter]=True,"T","F") AS Other,
    ',',
IIf([Planning_Support]=True,"T","F") AS Planning,
    ',',
IIf([Med_Review]=True,"T","F") AS Med,
    ',',
IIf([Counseling_Self_mgmt]=True,"T","F") AS Counseling,
    ',',
IIf([Comm_Family]=True,"T","F") AS Comm,
    ',',
IIf([Timely_Interactions]=True,"T","F") AS Timely,
    ',',
IIf([Add_Health_Prob]=True,"T","F") AS Add_Health,
    ',',
IIf([Patient_Services]=True,"T","F") AS Patient,
    ',',
    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~',
    ',',
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~',
    ',',
 Referral.EnrollmentDT,
    ',',
 [tblPhonePillars (3)].Ph14Date,
    ',',
    'Amount~~'
FROM
 (((([tblPhonePillars (4)] INNER JOIN ([tblPhonePillars (3)] INNER JOIN [1)ID/Name/Goals] ON [tblPhonePillars (3)].[StudyNo] = [1)ID/Name/Goals].[StudyNo]) ON [tblPhonePillars (4)].[StudyNo] = [1)ID/Name/Goals].[StudyNo]) INNER JOIN tblHomeVisitsPillars ON [1)ID/Name/Goals].[StudyNo] = tblHomeVisitsPillars.[StudyNo]) INNER JOIN tblHospitalVisitsPillars ON [1)ID/Name/Goals].[StudyNo] = tblHospitalVisitsPillars.[StudyNo]) INNER JOIN (([Contact Info] INNER JOIN Referral ON [Contact Info].[StudyNo] = Referral.[StudyNo]) INNER JOIN [tblPhonePillars (2)] ON Referral.[StudyNo] = [tblPhonePillars (2)].[StudyNo]) ON [1)ID/Name/Goals].[StudyNo] = Referral.[StudyNo]) INNER JOIN [tblPhonePillars (1)] ON Referral.[StudyNo] = [tblPhonePillars (1)].[StudyNo]
WHERE (((Referral.EnrollmentDT) Between [From Date] And [To Date]))
ASKER CERTIFIED SOLUTION
IrogSinta

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 33 Comments.
Start Free Trial
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 33 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