Program to run at certain time


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Program to run at certain time

  1. #1
    Join Date
    Jun 2006
    Posts
    168

    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

  2. #2
    Join Date
    Dec 2005
    Location
    South of Nowhere, Maine
    Posts
    309
    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.

  3. #3
    Join Date
    Jun 2006
    Posts
    168
    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

  4. #4
    Join Date
    Jun 2006
    Posts
    168
    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

  5. #5
    Join Date
    Dec 2003
    Posts
    2,750
    Quote 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)

  6. #6
    Join Date
    Jun 2006
    Posts
    168
    Quote 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

  1. Accessing Outllook controlls at run time
    By Soni in forum Enterprise
    Replies: 0
    Last Post: 01-11-2002, 02:55 AM
  2. Run time error- 430
    By Naveen in forum VB Classic
    Replies: 0
    Last Post: 01-15-2001, 12:53 AM
  3. ADO connection at run time
    By rkbnair in forum VB Classic
    Replies: 0
    Last Post: 07-18-2000, 03:15 PM
  4. Replies: 2
    Last Post: 04-22-2000, 05:17 PM
  5. changing datagrid properties at run time
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center