Running an Access Macro from ASP

Running an Access Macro from ASP

Question:
It’s possible to run an Access macro from ASP?

Answer:
Although you can run a macro from Access, it takes preparation, nerve and luck.
Preparation, because you have to set Internet Information Server 4.0 to allow out of process applications and give your IUSR_machine plenty of rights in the system.
Nerve, because you may end up rebooting your web server if you run a macro that doesn’t behave or causes a sharing violation.
Lucky, because some macros run and some don’t. The error messages you get may not relate to what you are doing.

To experiment, I created an Access 97 macro called CreateHTML. The macro writes the contents of a table to an HTML file. The directory needs to be read-write. The macro has these properties:

Action: OutputTo
Object Type: Table
Object Name: Countries
Output Format: HTML (*.html)
Output File: e:inetpubwwwrootaccesscountries.htm
Auto Start: Yes

I used the following VBScript code in my ASP file:

set objAccess=server.createobject(“Access.application”)
objAccess.Visible=False
objAccess.OpenCurrentDatabase “e:inetpubwwwrootaccesssitelist.mdb”, true
objAccess.DoCmd.RunMacro “createHTML”
objAccess.CloseCurrentDatabase
set objAccess=Nothing

It appears that Visual Basic for Applications isn’t yet well-suited to the ASP environment. That may have to do with its threading model.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular