Macro trouble

  • Thread starter Thread starter tcarter
  • Start date Start date
T

tcarter

Hi,

having followed the advice from 'Microsoft help' I can successfully run a
query when the database is opened. The query updates a table.

In the design view of the macro I have chosen 'OpenQuery' as the 'Action'.
In 'Action Arguments at the bottom, there has to be an entry in the 'View'
box. I'd rather there wasn't anything to see as a switchboard will be added
later on (I hope!).

Is there a simple way for a simpleton to get the macro to run the query
without the results being thrown up?

Cheers,

Regards,

TC
 
tcarter said:
Hi,

having followed the advice from 'Microsoft help' I can successfully run a
query when the database is opened. The query updates a table.

In the design view of the macro I have chosen 'OpenQuery' as the
'Action'. In 'Action Arguments at the bottom, there has to be an entry in
the 'View' box. I'd rather there wasn't anything to see as a switchboard
will be added later on (I hope!).

Is there a simple way for a simpleton to get the macro to run the query
without the results being thrown up?

Cheers,

Regards,

TC

TC,.

As you are running an action query if you choose "Datasheet" in the view
option there shouldn't be anything displayed in terms of query results.

You will also need to SetWarnings off before you run the query, and then
SetWarnings back on again afterwards.

Ed Metcalfe.
 
Thanks for the speedy and comforting reply.
You will also need to SetWarnings off before you run the query, and then
SetWarnings back on again afterwards.

Is it possible to incorporate this in the macro to stop users messing about
with the database (users who have even less idea than me, that is!)

Cheers,

Regards,

TC
 
Use 3 rows in your macro:
SetWarnings
RunSQL
SetWarnings

A serious disadvantage of turning SetWarnings off and back on again is that
you do not know if the action query completed successfully or not.

A better solution is to execute the action query in code. See:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
 
Back
Top