Append and make table query,prompting for yes or no from access

D

danijela.simunovic

Hi!

Is there a way that when I run a "make table query" and an "append
query" that i won't be asked those 2 or 3 questions from access like
:"you are about to run a make table...","the existing table ABCDE will
be deleated..." and so on prompting for yes or no! I would like to make
a command button which would prompt me for yes or no and then if i say
"yes" it would first run the make table query and then the append
query without access prompting me 5 times for yes or no(3 times for the
make table and 2 times for the append query)!
Any help\suggestions would be great!

Danijela
 
D

Douglas J. Steele

Either issue DoCmd.SetWarnings False before you run the queries (and
DoCmd.SetWarnings True afterwards), or, better in my opinion, use the
Execute method of either the Database or QueryDef object. (I say the latter
is better because it lets you trap any errors that may arise during the
execution)
 
D

danijela.simunovic

Can you explain to me how can i do the second thing: Executive
method...?!
Thanks

Danijela
 
D

Douglas J Steele

If you've got the SQL associated with the query (either as a string, or
stored in a variable), you can use something like:

CurrentDb().Execute "INSERT INTO Table1...", dbFailOnError

or

CurrentDb().Execute strSQL, dbFailOnError

If the query's been saved, you can use something like:

CurrentDb().QueryDefs("MySavedQuery").Execute, dbFailOnError

Note that if you're using Access 2000 or 2002, you'll have to ensure that a
reference to DAO exists (by default, neither of those versions of Access
include the reference to DAO)
 
K

kdagostino

I'm trying to do the same thing, except I don't need to prompt "Yes" or "No."

When I click the button, I want my two append queries to run, and not ask me
anything.

I don't understand where to enter the string you wrote down. Can you help me?
 
D

Douglas J Steele

Sounds as though you're currently using DoCmd.RunSQL to run your append
queries.

Use what I'm showing below instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top