Auto Answer Append Query

Emmanuel

Master Tech
Local time
Today, 15:38
Joined
Sep 4, 2002
Messages
88
Hi,

I need to ask a very annoying question. When creating an “append to query” it generates a warning if the values being append to the specified table are duplicates. When this option comes up you have three options: “Yes”, “No” or “Cancel”. As you know it is always “Yes” now how can I create a macro or a command that answers that question automatically for me? I need this because it’s like nine append queries and it has to be something automatic. I tried a “Send Keys” command and also I took out all the Warnings on the options screen. Do you have any suggestions.

Best Regards,
Emmanuel Roque
 
Code:
Docmd.setwarnings False
Docmd.openquery "yourqueryname"
Docmd.setwarnings true

Fuga.
 
Inserting VB Code?

Hi,

Thanks for the code. But I need further Help with it. How can I include this statement onto the append to query? I used to know of a way on how to convert any query to a VB code but I forgot how to do it. Can you help?

Regards,

Emmanuel
 
When do you want it done?
When you open a form? If so, open the form in design view, click events in the properties window, select on open - code builder and put it there.

On the click of a button? Do the same but select the button first.

Or you can put it in a module like this
Code:
sub runappends()
Docmd.setwarnings False
Docmd.openquery "yourqueryname"
Docmd.setwarnings true
end sub

and then call it from a form or a button or whatever:

runappends

I think you can do all this in a macro too, but I don´t remember exactly the commands.

Fuga.
 
If you'd like to shorten the code a bit, you can just use:

For DAO:
Currentdb.Execute "yourqueryname"

For ADO:
CurrentProject.Connection.Execute "yourqueryname"

The warnings are automatically suppessed, but I doubt it runs any faster.
 
Thanks

Thank You it worked as a charm.....


Best Regards,

Emmanuel
 

Users who are viewing this thread

Back
Top Bottom