Question : Export data from Access  to a .txt file, tab delimited, with short date and short time format

I need to export data daily to a flat txt file which includes an Arrival time data field  that must be split into a Short Date and Short Time format.  

Example Arrival 7/18/2010 0635 should be exported as
"07/18/2010" and "06:35"

tab delimited txt is the only format this older system can accept

I created a make table query that pulls out Arrival twice, once in Short Date Format, once as Short Time

I tried exporting using TransferText which worked for all fields except that it refomats the short date and short time back to a standard date format

I'm out of ideas.  I am not a programmer

Need to do this with queries and macros if possible

Answer : Export data from Access  to a .txt file, tab delimited, with short date and short time format

Hi harfang,

I tried this with a German and English version of Access 2007 and with a string literal containing the text in the initial post, it worked in all cases - but that doesn't mean it is the best and only solution...:-)

You are right, using Format is a lot easier than this construct. I simply forgot the Format function - shame on me...:-)

So the complete thing should be:

SELECT First(CLARITY_PAT_ENC_RSN_VISIT.ENC_REASON_ID) AS Complaint,
       CLARITY_PATIENT.ETHNIC_GROUP_C,
       CLARITY_PATIENT.MARITAL_STATUS_C,
       CLARITY_PATIENT.ADD_LINE_1,
       CLARITY_PATIENT.CITY,
       CLARITY_ZC_STATE.ABBR,
       CLARITY_ZC_COUNTY.NAME AS County,
       CLARITY_PATIENT.SEX,
       CLARITY_PATIENT.PAT_LAST_NAME,
       CLARITY_PATIENT.PAT_FIRST_NAME,
       CLARITY_PATIENT.BIRTH_DATE,
       Format(CLARITY_PAT_ENC_HSP.ADT_ARRIVAL_TIME, "mm/dd/yyyy") AS ArrvDt,
       CLARITY_PATIENT.PAT_MRN_ID AS MRN,
       CLARITY_PATIENT.ZIP, First(CLARITY_PATIENT.HOME_PHONE) AS [Home Phone],
       CLARITY_PATIENT.SSN,
       CLARITY_PAT_ENC_HSP.HSP_ACCOUNT_ID,
       CLARITY_PAT_ENC_HSP.ED_DISPOSITION_C,
       Format(CLARITY_PAT_ENC_HSP.ADT_ARRIVAL_TIME,"hh:mm") As ArrvTm
INTO [Extract]
FROM CLARITY_PAT_ENC_DX RIGHT JOIN (((((CLARITY_PATIENT INNER JOIN CLARITY_ZC_MARITAL_STATUS ON CLARITY_PATIENT.MARITAL_STATUS_C = CLARITY_ZC_MARITAL_STATUS.MARITAL_STATUS_C) INNER JOIN CLARITY_PAT_ENC_HSP ON CLARITY_PATIENT.PAT_ID = CLARITY_PAT_ENC_HSP.PAT_ID) INNER JOIN CLARITY_PAT_ENC_RSN_VISIT ON CLARITY_PAT_ENC_HSP.PAT_ENC_CSN_ID = CLARITY_PAT_ENC_RSN_VISIT.PAT_ENC_CSN_ID) INNER JOIN CLARITY_ZC_STATE ON CLARITY_PATIENT.STATE_C = CLARITY_ZC_STATE.STATE_C) INNER JOIN CLARITY_ZC_COUNTY ON CLARITY_PATIENT.COUNTY_C = CLARITY_ZC_COUNTY.COUNTY_C) ON CLARITY_PAT_ENC_DX.PAT_ENC_CSN_ID = CLARITY_PAT_ENC_HSP.PAT_ENC_CSN_ID
WHERE (((CLARITY_PAT_ENC_HSP.ED_EPISODE_ID) Is Not Null))
GROUP BY CLARITY_PATIENT.ETHNIC_GROUP_C, CLARITY_PATIENT.MARITAL_STATUS_C, CLARITY_PATIENT.ADD_LINE_1, CLARITY_PATIENT.CITY, CLARITY_ZC_STATE.ABBR, CLARITY_ZC_COUNTY.NAME, CLARITY_PATIENT.SEX, CLARITY_PATIENT.PAT_LAST_NAME, CLARITY_PATIENT.PAT_FIRST_NAME, CLARITY_PATIENT.BIRTH_DATE, CLARITY_PAT_ENC_HSP.ADT_ARRIVAL_TIME, CLARITY_PATIENT.PAT_MRN_ID, CLARITY_PATIENT.ZIP, CLARITY_PATIENT.SSN, CLARITY_PAT_ENC_HSP.HSP_ACCOUNT_ID, CLARITY_PAT_ENC_HSP.ED_DISPOSITION_C, CLARITY_PAT_ENC_HSP.ADT_ARRIVAL_TIME
HAVING (((CLARITY_PAT_ENC_HSP.ADT_ARRIVAL_TIME) Between [start] And [end]) AND ((CLARITY_PAT_ENC_HSP.ED_DISPOSITION_C) Is Null Or (CLARITY_PAT_ENC_HSP.ED_DISPOSITION_C)<>"1180"));



Cheers,

Christian
Random Solutions  
 
programming4us programming4us