All the things in my macro are not running

  • Thread starter Thread starter Kelly
  • Start date Start date
K

Kelly

I have a macro that is running 31 different append queries. When I run the
macro it gives me the key violation error on a couple of the append queries,
but when I go back and run them manually they work just fine.
Any ideas on why it's not working in the macro but it does when done manually.
~Kelly
 
Kelly

When an append query tells you that there's a key violation, it means that a
record (or many) cannot be added because it/they already exist.

I'm having trouble imagining why Access would actually add a duplicate key
record when you run the query directly, but refuse to when you run it in a
macro.

Can you confirm, after running the query "manually", that Access actually
DID add one/more duplicate-key records?

Or maybe it's the warning that's different...?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
It's not adding a duplicate record. It's giving me this error message when I
have nothing in the table yet. After I get the message I look at the table
to verify that nothing is in it and then manually run it and it works just
fine.
 
Kelly

OK, I'm stumped!

Have you tried tossing out the old query and creating a new one that does
the same thing? Then referring to that new query in your macro?

(sometimes the queries get subtly corrupted and it takes starting over...)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Ok, so I have figured it out now.
It was the order in which I had the queries running. Most of my tables have
many to many relationships so I of course have Join tables. I was trying to
add data to the Join tables before adding it to the tables it was connected
to, since I had referencial integrety set up.

Man, I'm glad I got that figured out it was driving my crazy.
Thanks for your help Jeff :-D

~Kelly
 
Thanks for posting back with your solution. Other folks may run into the
same kind of issue in the future and your solution may help them!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top