NigeP
07-07-2000, 12:44 AM
Hi, I am importing from an Excel Spreasheet with a field called CUSTOMER ORDER NO to a Table with a field called, CUSTOMER ORDER NO.
What condition would I write in order to stop the Macro if the CUSTOMER ORDER NO has already been imported on another occasion.
This is to avoid imports.
Thanks
Mike Gurman
07-07-2000, 02:06 AM
As far as I know, you can't actually examine the contents of a spreadsheet until after you've actually imported it.
You could import the spreadsheet to a temporary table, then run a 'find matched' query to compare it with your existing data; you can base the condition on the results of this query.
Alternatively, you could just import it, run a 'find unmatched' query (against your existing data); the query will only return rows if the order number is new. You could even set this up as an append query to append new records only directly into your database.
Mike
i import text file a lot. To avoid similar problems of double import my macro runs a delete query with the condition if id >0.
I also set warning to off befor i run the query, then the transfer macro is run. I then set warnings back to on, this way if i accidently double click i just have the latest table an no dublicate cases