-
Program to run at certain time
Here is what I need to do:
My program needs to run at a certain time when no one will be connected to the database (ie. midnight), and compact and repair it.
How can I make it so that the program will run at a specified time every day?
I can check the db for users who are connected,
and...I'm still trying to figure out the compact and repair thing... I have the zip file from the other thread from here-> http://www.freevbcode.com/ShowCode.Asp?ID=1024
I'm trying to figure out if I can just run that .exe using command line arguments or something to tell it the database to compact ( i know it does this), as well as the workspace (dont know if it can), and whatever else it would need.
but..I guess the main thing would be getting it to run at a certain time!
Any help is appreciated!
Thanks in advance
-Jon
Visual Basic 6.0
Microsoft Access 2003
-
Use the Windows Scheduler to make it run at a certain time.
As for the compacting command, I would either make a small app that just did the compacting, or make a command line switch to compact the database.
-
thanks, i'll look into using the windows scheduler.
I tried just using this code:
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''
Dim jro As New jro.JetEngine
jro.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dataSource & ";Jet OLEDBatabase Password=test", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\abbc2.mdb;Jet OLEDB:Engine Type=4;Jet OLEDBatabase Password=test"
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''
but I get error:
"Run-time error'-2147467259 (80004005)':
Cannot perform this operation; features in this version are not available in databases with older formats."
I have the reference to MS jet and replication objects library 2.6
do you know what would make that not work?
-Jon
Visual Basic 6.0
Microsoft Access 2003
-
Ok, How do I use the windows scheduler?
in the other thread pcelement pointed out that I did not have the database type parm in one part the call.
so i changed that. but it still gives the same error.
Code:
Public Sub CompactRepairDB(dbFname As String, Optional dbPath As String)
Dim jro As New jro.JetEngine
Dim dataSource As String
If dbPath = "" Then
dbPath = App.path
End If
If (Right(dbPath, 1) = "\") Or (Right(dbPath, 1) = "/") Then
dataSource = dbPath & dbFname
Else
dataSource = dbPath & "\" & dbFname
End If
jro.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dataSource & ";Jet OLEDB:Engine Type=4;Jet OLEDB:Database Password=test", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\abbc2.mdb;Jet OLEDB:Engine Type=4;Jet OLEDB:Database Password=test"
-Jon
Visual Basic 6.0
Microsoft Access 2003
-
 Originally Posted by cupacabrah
Ok, How do I use the windows scheduler?
You can add your app through the Scheduled Tasks applet in Control Panel.
Paul
~~~~
Microsoft MVP (Visual Basic)
-
 Originally Posted by pclement
You can add your app through the Scheduled Tasks applet in Control Panel.
Oh....thanks, man.
I should be good to go for a while now
the things we do on the j-o-b
-Jon
Visual Basic 6.0
Microsoft Access 2003
Similar Threads
-
By Soni in forum Enterprise
Replies: 0
Last Post: 01-11-2002, 02:55 AM
-
By Naveen in forum VB Classic
Replies: 0
Last Post: 01-15-2001, 12:53 AM
-
By rkbnair in forum VB Classic
Replies: 0
Last Post: 07-18-2000, 03:15 PM
-
By Pete Mitchell in forum VB Classic
Replies: 2
Last Post: 04-22-2000, 05:17 PM
-
By Ray Wood in forum VB Classic
Replies: 1
Last Post: 04-05-2000, 03:04 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks