Export Query to Excel then Delete Query data from Table (1 Viewer)

cochise

New member
Local time
Today, 11:27
Joined
Nov 20, 2013
Messages
4
Hi,

I am wondering if there is a quicker way to export a query to excel then have the data in that query removed from the original table. (effectively cutting the data from the table and exporting to excel)

I understand that this can be done by exporting the query to excel then running the same query as a delete query to remove the data but I just wondered if this is the most efficient way.

I have experience of VB in excel but currently only use the basic macro builder in Access though if Access VB is more efficient I can easily learn.

Many thanks for any help you can provide,

Cochise
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:27
Joined
Aug 30, 2003
Messages
36,123
I'd say that's probably the best method.
 

David R

I know a few things...
Local time
Today, 05:27
Joined
Oct 23, 2001
Messages
2,633
Do you really want to delete it? What if the Excel file goes AWOL?

Maybe an UPDATE query that 'archives' those rows and datestamps them with when they were exported...
 

cochise

New member
Local time
Today, 11:27
Joined
Nov 20, 2013
Messages
4
I am happy to delete the data as:

1) I have the complete original excel file of all the data that was originally imported into the table, and

2) I wish to export the remaining data after all queries have taken their data from it into a Miscellaneous Excel File for further analysis.

Many thanks for a prompt response and any help that you might give,

(and thanks to pbaldy for his reply)

Cochise
 

David R

I know a few things...
Local time
Today, 05:27
Joined
Oct 23, 2001
Messages
2,633
You can run both your Export and Delete queries via Macro. I can't remember if macros will let you suppress the "do you really want to delete this?" warnings, but VBA certainly would. Google SetWarnings, just remember to turn them back on when you're done!
 

cochise

New member
Local time
Today, 11:27
Joined
Nov 20, 2013
Messages
4
Thanks David,

If Macro method fails I'll investiagte the VB alternative.

Cochise
 

Users who are viewing this thread

Top Bottom