It depends on what is driving this import process. If you are running a
query using DoCmd.RunSQL, then using DoCmd.SetWarnings = False/True before
and after this will prevent any messages. I prefer however to use the
Execute method of the database object (eg. db.Execute). This allows you to
use the Err object to trap those errors and handle them however you wish.
Mike Storr
www.veraccess.com
"Sarah" <rhodesar@yahoo.com> wrote in message
news:739cac7d.0401201056.559760d@posting.google.co m...[color=blue]
> Hi
>
> I have written some basic code to import some data into my database.
> The problem is that I always get the key violation message "Microsoft
> can't append all the records in the append query" which I expect as I
> don't want to import duplicate data. This is fine. But the database
> will be used by other people and I don't want it to come up. Is there
> code in VBA I can use to automatically choose yes to this message??
> Or would an SQL statement be better. I only have a little knowledge
> of VBA and SQL so please bear that in mind.
>
> Thanks
>
> Sarah[/color]