Paul,
Thanks for the reference. I followed the instructions on that web page
(including only the Access portion of the code). Here is the code that I
have so far:
****************
Imports Access = Microsoft.Office.Interop.Access
Public Class WebForm1
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim oAccess As Access.ApplicationClass
'Start Access and open the database.
oAccess = Server.CreateObject("Access.Application")
oAccess.Visible = True
oAccess.OpenCurrentDatabase("c:\BizRulesProject\bizrules.mdb",
False)
'Run the macros.
oAccess.Run("DoKbTest")
oAccess.Run("DoKbTestWithParameter", "Hello from VB .NET
Client")
'Clean-up: Quit Access without saving changes to the database.
oAccess.DoCmd().Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oAccess)
oAccess = Nothing
GC.Collect()
End Sub
End Class
****************
I am getting the error "System.UnauthorizedAccessException: Access is
denied." when I click on the button that executes the "Button1_Click"
function.
To try and fix this, I added the ASPNET user to my Inetpub directory and
made sure it was in all of the subfolders (i.e. "wwwroot"). I gave this
user read, write and execute permissions. I also added my local "IUSR"
account and gave the same permissions.
I re-run the web browser and I get the same "Unauthorized Access" error.
I am not exactly sure which user ASP.NET is using to run the
application. I assume it is the "ASP.NET Machine Account". I wanted to
add the IUSR account just to be on the safe side. DO I have the right
user? Am I adding the user to the appropriate folders (Inetpub and
below)?
HELP! I feel like I'm sooooooo close!
Matt