HELP: Server.CreateObject("Access.Application") ERROR
am 02.09.2005 13:00:09 von WolfWomanHi,
This is an ongoing problem which I simply cannot fix.
I have an ASP application which uses Access Reporting to create
invoices. In order to run the report, I make use of
Server.CreateObject("Access.Application").
This works fine when running the client and server on the same
Windows XP computer.
I have uploaded it to my hosting site, run it from here and the I get
an error on executing the line
Server.CreateObject("Access.Application").
I have done lots of research on this and gather it is something to do
with Access Permissions and user accounts. Is that correct? Is there
any workaround?
I have also tried running this application on a local network, again
using a separate server to run IIS and connecting from a client via a
network. I get the same error. However I am at liberty to change Access
Database permissions locally. Question is what combination of changes
are the correct one?? I have tried all sorts of username, folder
permissions, etc etc and have got nowhere.
PLEASE HELP if you can. I would really be very very grateful.
Here is an extract of code:
Lynn
Dim objAccess 'This is our MSAccess object
dim MyFileLocation
'----------------------------------------------------------- ------
'Now we get the data we need from the submitted Form
'----------------------------------------------------------- ------
strDbName = strPath
MyReportDesc = Request.QueryString("ReportDesc")
strRptName = Request.QueryString("ReportID")
strWhere = "invoice_id=" & Request.QueryString("Invoice_Id")
strFilter = ""
strSnapFile = "Invoice" & Request.QueryString("Order_Id")& ".snp"
MyFileVirt = "Invoices" & Request.QueryString("InvoiceType")& "/" &
"Invoice" & Request.QueryString("Invoice_Id") & ".snp"
Err.Clear
'----------------------------------------------------------- ------
' Create an instance of access. Visible is set to false b/c
' this is running as a proccess, not as a desktop application
'----------------------------------------------------------- ------
if err <> 0 then
Response.Write "Errors before creating application"
End If
Set objAccess = Server.CreateObject("Access.Application")
objAccess.Visible = False
if err <> 0 then
Response.Write "Errors before opening database 1"
End If
'----------------------------------------------------------- ------
' Open the database, then the Report, and output it in Snapshot format
'----------------------------------------------------------- ------
objAccess.OpenCurrentDatabase strDbName
if err <> 0 then
Response.Write "Errors on opening database 2"
End If
'With objAccess.DoCmd
' open in preview mode so that we can pass a where clause
' if neccesary
objAccess.DoCmd.OpenReport "Inv" & Request.QueryString("InvoiceType"),
acViewPreview, strFilter, strWhere
if err <> 0 then
Response.Write "Errors on OpenReport"
Response.Write "1:" &strRptName & "
"
Response.Write "2:" & acViewPreview & "
"
Response.end
End If