COMBINE DATA AS TEXT BY UNION QUERY

VKKT
2StarLounger
Posts: 184
Joined: 13 Jun 2018, 07:50

COMBINE DATA AS TEXT BY UNION QUERY

Post by VKKT »

Hi all,

Greetings :cheers: :cheers:

I have two tables which I am trying to combine and I did the below union query and it is working, but I want the data to be in text file.

Please help me on this.

SELECT STAFFID, DATE_, DATE1, NoOfHours, PROJECTID, TASKCODE, DetailedDescription, REMARKS, CRE FROM [TIME SHEET DATA-AS];
UNION SELECT STAFFID, DATE_, DATE1, NoOfHours, PROJECTID, TASKCODE, DetailedDescription, REMARKS, CRE FROM [TIME SHEET DATA-ASAMI];

Regards,
VKKT

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: COMBINE DATA AS TEXT BY UNION QUERY

Post by HansV »

If you want to export the result of the query to a text file:
- Select the query in the navigation pane.
- Activate the External Data tab of the ribbon.
- Click Text File in the Export group.
- Access starts the Export Text Wizard.
- Select Delimited or Fixed Width, then click 'Next >'.
- Depending on your choice, you can specify some other settings, then click 'Next >'.
- Specify the path and filename, and click Finish.
- You'll get the option to save the export steps.
- If you do, you can re-run the export later on both from the Access interface and using VBA: DoCmd.RunSavedImportExport
Best wishes,
Hans

VKKT
2StarLounger
Posts: 184
Joined: 13 Jun 2018, 07:50

Re: COMBINE DATA AS TEXT BY UNION QUERY

Post by VKKT »

Thanks Mr. Hans for your immediate response.

Actually I need to have the data in another table in access itself without showing the linked tables drop-in fields.

Now I have another question, how to make the files updated with the new added data only without over wiring the existing data by using a query?

Regards,
VKKT

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: COMBINE DATA AS TEXT BY UNION QUERY

Post by HansV »

How can we determine which records are new?
Best wishes,
Hans

VKKT
2StarLounger
Posts: 184
Joined: 13 Jun 2018, 07:50

Re: COMBINE DATA AS TEXT BY UNION QUERY

Post by VKKT »

Hi,
Greetings!

‘Date of entry’ field this is auto date n time of entry, this can be taken as a criteria of new record.

Regards,
VKKT

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: COMBINE DATA AS TEXT BY UNION QUERY

Post by HansV »

Perhaps

INSERT INTO [TargetTable] SELECT * FROM [SourceTable] WHERE [SourceTable].[Date of Entry] > DMax("[Date of Entry]", "[TargetTable]")
Best wishes,
Hans

VKKT
2StarLounger
Posts: 184
Joined: 13 Jun 2018, 07:50

Re: COMBINE DATA AS TEXT BY UNION QUERY

Post by VKKT »

Greetings!
It is working well, sorry for the delay in response, I was busy with something else now only I tried this.
Thanks Hans for your support.
Regards,
VKKT :cheers: :cheers: