How can i schedule a access query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sunil Gahlot
    New Member
    • Dec 2011
    • 1

    How can i schedule a access query

    Hi all ,
    i run a query on daily basis manually using ms access database.i want to run this query automatically on daily basis on a perticular time.can anybody suggest me something.
    what i tried ,i made a shortcut and ttried to schedule the query...but it didnt work out .thanks in advance for your suggestion
  • sierra7
    Recognized Expert Contributor
    • Sep 2007
    • 446

    #2
    Hi
    I have never done this but would start by creating a small Access application, that obviously must have links to the backend data, and have a startup form which then called the query from its On_Open event.

    I don't know whether you are running an UPDATE query or a MAKE-TABLE query (there would be no point running a select query if there was no-one to view the screen !) but I suspect the form would also need a timer to close the application.

    I would look to run this from Windows Scheduler but, as I said above, I have never tried this.

    Good Luck
    S7

    Comment

    • TheSmileyCoder
      Recognized Expert Moderator Top Contributor
      • Dec 2009
      • 2322

      #3
      Access by itself only runs when its open. So you cannot using solely access schedule any events. As Sierra said, if you use another program to open the database, it might be possible to make a form that opens automatically (hidden possibly) executes the query, and closes it self when done.

      If you for some reasons always have access open, you can use a form with a timer, to test whether its time to run your query.

      Comment

      • sierra7
        Recognized Expert Contributor
        • Sep 2007
        • 446

        #4
        Hi again,
        I can now confirm that the method proposed in my last post does actually work.

        In an existing project I created a form that opens a report in the On_Load event (Also works On_Open) and has a Timer set to 100 milliseconds and a DoCmd.Quit in the Timer Event.

        I closed the project and went to Windows Task Scheduler and created a new task (to run once only!). All I needed to do was specify the start time to 2 minutes hence, then path to the .mdb file (Did NOT need to pass the path to msaccess.exe!) Sit back and wait.

        Access oppened, the form opened for an instant then closed Access, while the printer was producing paper!

        S7

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32636

          #5
          This link (Invoking a Database From the Command Line) gives you full details of how to schedule your tasks in an Access project.

          Comment

          Working...