Scheduling Hourly Import/Export

  • Thread starter Thread starter Sheldon
  • Start date Start date
S

Sheldon

Hello -

How do you schedule an hourly import of tables after you save an import?

Any help will be appreciated!
 
Access doesn't have anything built-in that hands scheduleing per se - you
have to build it. One way is to create a form that is opened as acHidden at
startup that has code in the OnTimer event that executes. The TimerInterval
determines the interval at which OnTimer fires.

The challenge though is that the database *must* be opened along with the
form, otherwise it won't run.

Another alternative, is to develop code in Access that executes the import
and then develop a Windows Host Script that opens Access and executes the
code. To have the code execute once an hour, you'd then have to set up a
Windows Task to execute the code. The nice thing is that you should be able
to do this on your server or set it up on your local machine. By having it
run independent of the Access session that you're running, it'll effectively
run in the background and not impact you're use of Access - other than your
PC possibly slowing down a bit. Here's code that'll get you started, it
basically opens Access... (Pardon the formating)

More information on Windows Script Host is availble here...
http://msdn.microsoft.com/en-us/library/9bbdkx3k(VS.85).aspx

'-----Start Script-----

Dim dbEngine
Dim db

Set dbEngine = CreateObject("DAO.DBEngine.36")

Set db = dbEngine.OpenDatabase (strDB)

'Insert code here to manipulate Access, you should be able to copy and past
the code from Access to here and have it run

db.close

set db = nothing

Set dbEngine = Nothing

sub checkVersion
'-----End Script-----
 
Back
Top