Graeme,
Regarding the temporary table idea, you can make a table in the frontend
database, with the structure you want for the imported data. Then you
can use a Delete Query (which can be run from within the macro using the
OpenQuery action), to clear any residual data from this table prior to
your import. I am not sure how you are importing the data, or where
it's coming from, I don't think you mentioned, but I assume you have
this part of it under control. So you just import to this now empty
table. Then, based on this table, make an Append Query to run the data
into your main table, and once again, an OpenQuery action in the macro
will do this. Once you have this all working, you might want to put a
SetWarnigs/No action at the beginning of the macro to suppress the
action query confirmation prompts.
The way we have discussed this so far, using the unique index, if the
imported data already exists, the Append Query will simply not append,
end of story. If you want a message box to inform the user that this is
what has happened, you can put a MsgBox action in the macro prior to the
OpenQuery for the Append. You would put a Condition in here... if you
can't see the Condition column in the macro design window, select it
from the View menu. The Condition will look like this:
DCount("*","YourQuery")>0
What is YourQuery? You will make a query that includes the "temporary
table" and the main data table, joined on all 5 of the fields that
comprise the unique index. And add any field from the main table to the
query design grid. Get the idea? If there are any duplicates, this
query will show it, whereas if there are no duplicates, this query will
return no records. So yopu macro condition means the MsgBox will only
run if there are records returned by this query, i.e. if there is a
duplicate.