Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2007
    Posts
    8

    Question Unanswered: How to schedule an access database to open, and close

    I have an access database which on open deletes information from 2 tables, and then runs append queries to re-update the information to those tables. I am using those tables to update information within my Crystal Report, so I would like to know how to go about scheduling my AccessDatabase to open, and then close like every 4 hours. Does this need to be done with a marco, or is it as simple as using Windows Scheduler

    Any help on this would be great

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You would either save the macro as the Autoexec macro (set the warnings to false, run the queries, set the warnings to true in the macro, exit the mdb for commands) or write some code to do the same thing and have that code run when the mdb opens.

    Regarding scheduling it, you probably want to schedule the mdb to open with Windows Scheduler. I've often done it this way. Another option is making a vb script which updates the mdb and is run via windows scheduler. Or if it's SQL Server, scheduling a package which updates.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Nov 2007
    Posts
    8

    Question

    Quick question with windows scheduler...once scheduler runs the scheduled task, does scheduler close the database. If not does anyone or yourself know the vb script to open, run, and the close an exit an access database...my knowledge of VB and scripting is minimal at best

    Regard

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    If you create an autoexec macro, when the Access mdb opens, it runs the autoexec macro on startup. Or if you designate a form or some code to run in the Startup (Tools -> Startup), it will execute that first (so you can either do it via an autoexec macro or via the Tools->Startup). Once you are done running whatever code or macro you design, the last statement of your code will be a docmd.quit which exits the mdb file.
    You windows scheduled task just needs to open the Access mdb file.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •