Re: Newbie question about formula based values



You can use Windows Scheduler (in Control Panel) to run the query whenever
you want. The way you'd do it is as follows:

1) Create your query.

2) Create a macro. In this macro have a single item that calls RunCode. Have
it call a routine you create.

3) In the routine that you referenced in the macro, do the following:

Currentdb.Execute "MyQuery", dbfailonerror
Docmd.Quit

That will run your macro and then close the application when it's done.

4) In Windows scheduler, create a new scheduled task based on Microsoft
Access. Go into the task and edit it, telling it to open your database. At
the end of that line, put /x macroname. Example:

c:\program files\office\msaccess.exe c:\somedir\mydatabase.mdb /x
mymacroname

Note that you have to specify the path to msaccess.exe if you want to use
the supplemental arguments.

Is that clear? If not, let me know.

Neil



"Mintyman" <mintyman@xxxxxxxxxxxx> wrote in message
news:6Ni2j.5612$B97.4576@xxxxxxxxxxxxxxxxxxxxxxx
Hi Neil,

Will this query only run when I run it in Access? I would like these
values to be updated on a constant basis without me having to do anything.
I wasn't sure if Access could do this or whether i'm getting confused with
SQL stored proedures.

An alternative would be to place the code on a webpage on my site that
will be accessed on a daily basis. That way, the query could be triggered
every time a visitor loads that specific page.

"Neil" <nospam@xxxxxxxxxx> wrote in message
news:dq_1j.1362$AR7.112@xxxxxxxxxxxxxxxxxxxxxxx
You can create a query; don't add any tables; click the SQL button; and
then add the following:

Update MyTable Set Level=1 Where EndDate<Date()

If you want to ONLY update if the level was 2 (e.g., not 3), then you'd
do:

Update MyTable Set Level=1 Where EndDate<Date() AND Level=2

Save your query, and then, when you open it from the database window, it
will update your records.

(Be sure to substitute the actual name of your table for MyTable.)


"Mintyman" <mintyman@xxxxxxxxxxxx> wrote in message
news:NRZ1j.12827$Ew3.9757@xxxxxxxxxxxxxxxxxxxxxxx
HI,

I'm not that experienced in Access so am turning to the experts for some
basic help.

I have the following fields in a table :

Name Type
Level Number
Start Date Date
End Date Date

Is it possible to have some code that will automatically change the
value of 'level' from 2 to 1 if today's date is greater than 'End Date'?
Effectively, I want the customer's access level to drop once their
contract has run out. At the moment I have to keep an eye on when
customer contracts are due to end and manually update the value in the
'level' field from 2 to 1.

Can anyone show me how to do this?

Thanks!









.



Relevant Pages

  • Re: Newbie question about formula based values
    ... I agree this query only needs to be run once a day. ... In this macro have a single item that calls RunCode. ... Go into the task and edit it, telling it to open your database. ... Update MyTable Set Level=1 Where EndDate<DateAND Level=2 ...
    (comp.databases.ms-access)
  • schedule macro
    ... with windows scheduler on my local and my database on a network; ... cannot get a macro to execute.(run a query and export to a text file using ... it opens up access but the macro does run. ... format in the command line and just "C:\PathToDB\YourDB.mdb" /x NameOfMacro ...
    (microsoft.public.access.macros)
  • schedule macro
    ... with windows scheduler on my local and my database on a network; ... cannot get a macro to execute.(run a query and export to a text file using ... it opens up access but the macro does run. ... format in the command line and just "C:\PathToDB\YourDB.mdb" /x NameOfMacro ...
    (microsoft.public.access.macros)
  • Re: Date Query
    ... >how can i make a query which will automatically run 2nd tuesday of every ... I'd use the Windows Scheduler to launch Access on that schedule; ... will execute the macro named MyMacro; this can have a RunQuery action ...
    (microsoft.public.access.queries)
  • schedule macro
    ... with windows scheduler on my local and my database on a network; ... cannot get a macro to execute.(run a query and export to a text file using ... it opens up access but the macro does run. ... format in the command line and just "C:\PathToDB\YourDB.mdb" /x NameOfMacro ...
    (microsoft.public.access.macros)