Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close Access Thru Scheduler 1

Status
Not open for further replies.

rcaesar

MIS
Sep 5, 2002
92
US
Hi,

I use the Hal scheduler to compact and run some macros.

How would I use the scheduler (or the Windows scheduler) to close Access completely.

I tried using Application.Quit acQuitSaveAll in the scheduler, but it just doesn't do anything (no errors, and doesn't close it).

Is there a macro (or code) I can use thru the scheduler to close.

If I have use Shell, could someone give me some clues as to how to set it up - I have little experience with it.

You guys have always come thru, and any help will be appreciated.

Thanks


 
You can run a script from the task scheduler using a .vbs file (VBScript) if you have permissions. Create the script using Notepad and name it "CloseAcess.vbs", then assign the file to your task using the task scheduler, and enter a username and password to allow it to run. The script would look something like this:
Code:
Const acQuitSaveAll = 1

On Error Resume Next

Set acc = GetObject("C:\Databases\TekTips.mdb")

If Err.Number = 0 Then
   acc.DoCmd.Quit acQuitSaveAll
End If

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
Hi VBSlammer,

That was really great. I just tested it out, and it works like a charm.

Thanks a lot for your help and you deserve a star, the reason being, I have more or less searched this and other sites, and many have offered solutions, but this was the most straight forward, and extremely simple to use.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top