Displaying MS Access reports

D

Donald Wheeler

Hi all,

I have a critical problem - our client wants to be able to display reports
that they've made in MS Access over a web-based interface. I thought that
this would be straightforward but the following code *always* gives the '
Microsoft Access can't open the database because it is missing, or opened
exclusively by another user. ' error, regardless of whether an Access
instance is running or not (the path is correct).

---------------------------------

On Error Resume Next

Dim objAccess,filePath

Set objAccess = CreateObject("Access.Application")
filePath = Server.MapPath("commute_reporting.mdb")

objAccess.OpenCurrentDatabase filePath

If Err.Number=0 Then
objAccess.DoCmd.OpenReport "CarpoolReport", acViewPreview,
acReadOnly
objAccess.DoCmd.OutputTo 3, "CarpoolReport", "Snapshot Format
(*.snp)", "Carpool.snp"
objAccess.DoCmd.Quit 2
Else
Response.Write "Error Number - " & Err.Number & "<br />"
Response.Write "Error Source - " & Err.Source & "<br />"
Response.Write "Error Description - " & Err.Description & "<br />"
End If

objAccess.CloseCurrentDatabase
objAccess.Quit
Set objAccess = Nothing

On Error Goto 0

---------------------------------

The only non-scripting options that I've found have been extremely
expensive; has anyone else done this? Do you have any suggestions? I can't
find much if at all on this problem, other than make sure that the filename
is correct.

Thanks for your help!
Donald
 
B

Brendan Reynolds

Server.MapPath returns the absolute path of a file *on the server*. But the
instance of Access you are creating is not on the server, it is on the
client. So your path is perfectly valid, but only on the server. Access is
telling you quite correctly that the database is missing, because the path
does not exist on the client. If the instance of Access you are creating
*was* on the server, it wouldn't do you any good, because when it displayed
reports, it would display them on the server's monitor.

As you've cross-posted this to the data access pages newsgroup, I guess
you've already figured out that data access pages may be one possible
solution to your problem. But try a search of the archives at
www.google.com/groups - I'm sure I've seem mention of a third-party tool
that is supposed to be able to do this.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
M

Mark Andrews

Our report server product enables you to build a web interface for users to
run your Access reports. When a report is requested it is created live on
the server as a pdf file and redirected to the user.

We have thousands of users and the product is very stable and has not
changed in a few years. Also very inexpensive.

Download the free eval and try it out,
Mark
RPT Software
http://www.rptsoftware.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top