-----Original Message-----
Hello,
Howdy.
I have created a WEB file with FrontPage and I find out
how to get the data from my database in Ms-ACCESS.
My question is if this is possible to execute a macro
created in ACCESS from the WEB site with VBScript?
No. You have to do your VB programming in an ASP or
ASP.NET page.
Also, I would like to know if there is a way to execute
my macro automatically. For example, I want that one of
my macro start by itself each midnight.
If you want your process to run at true midnight, you'll
need to do one of these:
o Create a command line program in VB6 or VB.NET, and
then schedule it to run on the Web server.
o Create a Web service that runs on the Web server, and
a command-line program that you schedule to run on
some other computer. The command-line program would
call the Web service, and the Web service would
access the database.
This is a more complex solution than the first, but
it doesn't require setting up a scheduled task on the
Web server.
o If your midnight process doesn't update the database,
then download the database at midnight and run your
process against the downloaded copy.
If your process doesn't need to run at exactly midnight,
and if it runs very quickly, you can add it to
global.asa. Here's an example:
Sub Session_OnStart
If "" & Session("SchedDate") = "" Then
Session("SchedDate") = Today - 1
End If
If Session("SchedDate") <> Today Then
' ----------------------------
' Your daily process goes here.
' ----------------------------
Session("SchedDate") = Today
End If
End Sub
Any code that you place in the area marked "Your daily
process goes here" will run whenever the first visitor
arrives after a Web server restart, or after the current
date changes. The visitor, however, won't get your first
Web page until that process completes.
Backing up your database once a day, BTW, is tricky
because you should always mark folders that contain a
database as non-browsable. This stops Web visitors from
downloading your database, but it stops you as well.
One approach is to download the file via command-line (and
hopefully password-protected) FTP. Another is to:
1. Browse
http://www.interlacken.com/winnt/dnld/.
2. Select Forcing File Downloads (ASP), then download
and unzip the aspdnld.zip file.
3. Add the download.asp page to a password-protected
subweb, and configure the page to download your
database.
4. Use the curl program from
http://curl.haxx.se/
to run the download.asp page you configured in
step 3. curl is a command line program that can
copy data from a http:// location to your hard
disk.
Regardless of whether you use FTP or curl, you can place
the commands in a bat file and then schedule the bat file
to run whenever you want. And of course, if you want to
run off some reports or whatever in the same bat file,
that's fine.
Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------