Conditional Macro (1 Viewer)

NigeP

New member
Local time
Today, 04:46
Joined
Jun 16, 2000
Messages
8
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
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 04:46
Joined
Jun 16, 2000
Messages
1,954
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
 

3x3

New member
Local time
Today, 04:46
Joined
Apr 21, 2000
Messages
8
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
 

Users who are viewing this thread

Top Bottom