View Full Version : Trying to run queries through a command button


DDONNI
09-21-2004, 07:39 AM
Hi Guys i'm now trying to create a form as a menu where i can execute Macros at the click of a button and also to generate reports. The problem i've got is i'm trying to setup a command button to run a set of queries but i can't seem to find a way of doing this. I've tried to add the query to a macro and then add the macro to the command button but i can't seem to find an option to add a query to a macro i've also tried copying the sql code from the query and putting it into the command button but the code is quite large well over 4000 characters and it said the limit was just over 2000. Does anyone have any ideas.

Also if you have any ideas on my other formatting Thread i would be grateful.

Cheers.

FoFa
09-21-2004, 07:50 AM
Use the OPENQUERY command in your macro, you can add as many as you like.

DDONNI
09-21-2004, 08:41 AM
I've tried this but it only allows you to read, edit or add. the query is appending an existing table i don't want to be able to see the query i just want to make it run at the click of a button.

Any other ideas?

FoFa
09-21-2004, 12:31 PM
First make sure your QUERY is an APPEND query (not select).
Use SetWarnings FALSE in your macro to turn off the warnings
Use OpenQuery to run the query

I do this ALL the time. I suspect your query is not set to APPEND mode.

DDONNI
09-22-2004, 03:38 AM
Cheers mate thats great its working now i don't know what i was doing wrong before i think i had it set to edit. but i am running an append query.