Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Compactor Template    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Access Compactor Template Issue
Joseph Sylvester 
     
46 days ago
I just purchased the Access Learning Zone "Access Compactor template". It works fine, but I am having problems creating a task to run the compactor database at startup with Windows Yask Scheduler. U reboot and the task syayis is currently running. It is still running after an hour. I searched online and the answers suggest either the task is hung or waiting for input. I can run the commands direcftkly from a cmd terminal and it executes with no problems. I have no idea if I have a Windows issue and/or a access problem. Any suggestions?
Alex Hedley  @Reply  
           
46 days ago
What does your Task look like?
Richard Rost  @Reply  
          
46 days ago
Alex is asking the right first question: the exact Task Scheduler setup matters.

A few things I would check:

Make sure the task is launching the full path to MSACCESS.EXE, not just the database file.

Make sure the database path is in quotes.

Make sure the "Start in" folder is set to the folder where the compactor database lives. Access can behave differently when launched by Task Scheduler because the working folder may not be what you expect.

For testing, set the task to "Run only when user is logged on." Access is a desktop application, and running it in a hidden/non-interactive background session can sometimes hang if there is any prompt, trusted-location warning, missing reference, linked table issue, security prompt, etc.

I would also add a simple log table or text file to the compactor database so it records each step: startup, beginning compact, finished compact, and quitting. That will tell us exactly where it is getting stuck.

And finally, make sure the compactor database actually closes Access when it is finished, for example with DoCmd.Quit acQuitSaveNone.
Joseph Sylvester OP  @Reply  
     
45 days ago
Alex  Program: C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE", argumentL C:\Users\Joseph\Documents\Compactor\My Database\Compactor.accdb"(compactor database).
Joseph Sylvester OP  @Reply  
     
45 days ago
Richard  When I set the "Start in" directory to the directory that the compactor dagabase is in, Ithe task fais with "invalid directory" I double checked - the directory I entered IS valid.
Richard Rost  @Reply  
          
45 days ago
Double check your double quotes - the one you put in above is missing an opening "
Joseph Sylvester OP  @Reply  
     
44 days ago
Richard I verifiedf all strings are enclosed in quotes. I started over, directly browsing to MSACCESS.EXE, and copying full paths from File Explored to database and folder. II still get invalid directory  0x8007010B. I can run the contents of task successfully from cmd terminal.
Joseph Sylvester OP  @Reply  
     
44 days ago
Richard I was able to get the task to run successfully m,anually. I left the "Start in" field blank. However, I rebooted to see if it would run at startup, but it did not run. The status said it ran successfully, but the compacted database timestamp was unchanged from the manual run.
Richard Rost  @Reply  
          
44 days ago
Alex is on the right track asking to see the exact task setup, because with Task Scheduler the little details matter a lot.

That 0x8007010B error is almost always related to the "Start in" path. Even if the folder exists, Task Scheduler is very picky about that field. Make sure it's just the folder path with no quotes at all, like:

C:\Users\Joseph\Documents\Compactor\My Database

If you put quotes in there, or if there's a typo or trailing slash, it can throw that exact error.

The other clue is that it says it ran successfully at startup but nothing actually happened. That usually means Access launched, but then got stuck waiting on something or didn't execute your code. Remember Access is a desktop app, so if it hits any kind of prompt (trusted location warning, missing reference, linked table issue, etc.), it can just sit there silently.

A couple things I would try:

Set the task to "Run only when user is logged on" while testing. Running in a non-interactive session is a common cause of this kind of behavior.

Double check the "Start in" path as above, no quotes, just the folder.

Consider adding a command-line switch to force something to run on startup, like using an AutoExec macro:

"C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" "C:\path\Compactor.accdb" /x AutoExec

That way you know your code is actually being triggered.

Add a simple log (even just writing to a text file) at the start and end of your compactor process so you can see if it's launching and where it might be stopping.

Also, if this is running at system startup, Windows can fire the task before your user profile (and things like Documents/OneDrive) are fully ready. Try adding a delay of 30-60 seconds to the task trigger, or switch it to run "At logon" instead of "At startup".

Since you said it works fine from the command prompt, that tells us the command itself is good. So at this point it's almost certainly Task Scheduler context, working directory, or timing.
Joseph Sylvester OP  @Reply  
     
43 days ago
Richard Great news! My task is now running suvvrddfilly. I started when I added the "/x AutoExec" option. It failed (I believe because there was no AitoExec macro(). It was if that failure woke it up. I then tried to run it again with no options and it ran successfully, I still have to leave the "Start in" field blank. I believe I have asystem problrm. Thanks for everyone's hel[.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Compactor Template.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/16/2026 1:34:11 AM. PLT: 1s