Query Criteria not before date

D

Don

Using A2007 I'm designing an archive query that can only be run after the end
of the year. I've got the query to return the appropriate year (current) but
i don't want it to used until the new year.

Any thoughts as to how I would prevent the query from being accidently run?
 
K

Ken Snell [MVP]

If you give your users access to the Database / Navigation pane, then no. If
you do not let your users have direct access to the queries, and instead
control the running of queries by a macro or form, then yes.

What is your setup?
 
G

Gina Whipp

Don,

Thinking out loud here...

What if you made the query run using the previous year, since your not going
to run it until next year anyway. That way even IF it is accidently run,
who cares it's running using the current year.

Also, you don't state where you putting the query that it could be
accidently run. Is it on the Main Menu?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
D

Don

I should have mentioned this archive query is in fact a Make Table query so
it's going to overwrite any existing archived data anyway! i'll just put some
warning messages on the Archive Data forms' run query button.
thanks for your thoughts anyway....
 
J

John W. Vinson

I should have mentioned this archive query is in fact a Make Table query so
it's going to overwrite any existing archived data anyway! i'll just put some
warning messages on the Archive Data forms' run query button.
thanks for your thoughts anyway....

Just put code in the run query button code to check today's date before
running the query. However, every day in the year is in "a new year" - you
might not get around to running the query until November, right?
 
T

Tom van Stiphout

On Thu, 28 May 2009 05:05:01 -0700, Don

You could hide the query. Unfortunately queries are too simple to
allow "Are you sure you want to run this?" - kind of dialogs.
I guess you could force an error by having the query call a VBA
function that returns an illegal value or even issue a Stop
instruction, but that would be rather crude.
You can also grab the sqlstatement of this query and put it in a code
module, delete the query, and and execute it only from code.

-Tom.
Microsoft Access MVP
 
Top