Setting table field to true when exporting to csv

dannewestis

Registered User.
Local time
Today, 18:32
Joined
Sep 15, 2006
Messages
12
Hi,

I export a query as csv to upload to another database on a web site. When that csv file has been exported I'd like the query to be emptied, so that the next time I export I don't export duplicates. What's the easiest way to do that?

I've been thinking of having a field in the table with a check box that is checked when the file is exported. The query then selects only those records where that box is not checked.

But how can I check those boxes on Export rather than when I run the query? The reason being that I may want to preview by running the query, without having that affecting the check box.
 
I think the best way is to create a select query that always selects the records you want to export. In that select query, ONLY select the primary key field. Then in your export query, in the criteria, use IN (SELECT [primarykey] from myselect query). Then AFTER tha actual export is run, run an update query to update your export flag and in it's criteria use the same IN (SELECT [primarykey] from myselect query). These subselects for the IN would go in the criteria for the primary key. This way you can break them apart and only run the second one after the actual export was run. Also if the record selection needs to change for some reason, you only have to change the SELECT query and both of those queries will be fine still.
 

Users who are viewing this thread

Back
Top Bottom