Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
May 24, 1998

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:\inetpub\wwwroot\access\countries.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:\inetpub\wwwroot\access\sitelist.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.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date