• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

Running Access Database macro from .aspx web form using visual basic

I would like a macro to be executed, when a certain button is pressed on the form. Have found a couple of solutions, all of them start with something like Dim Adb As New Access.Application
But in my version of Visual Studio (2013 for Web) there isn't such type of variable as Access.Application, so it doesn't work.
German Mikulski
German Mikulski
  • 2
1 Solution
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Macros and VBA Code must be run in the Access environment. You can use the Office Interops assembly to do these things:


However, since you're presumably running this on a web server that is NOT local to the Access database, I'm not sure you'll be able to do this. You cannot open an Access database that is not on the same physical network as your own (i.e on the same LAN or WAN), and it would be doubtful your web server is on the same W/LAN. Also you'd need to have those Office Interops assemblies installed on the web server (which is mot likely not going to happen unless you own and host the web server yourself).

What does the macro do? There might be a different way to manage it ...
German MikulskiAuthor Commented:
This is relate to the previous question you were trying to solve for me :)

I'm still trying to come up with some kind of solution for this problem.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I posted a comment over there, but it looks like you're moving to an ASP.NET solution?

If so, then my original comment applies - unless your database is local to the web server, you can't do this.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now