Welcome to WebmasterWorld Guest from 54.146.217.179

Forum Moderators: phranque

Message Too Old, No Replies

Error: Microsoft Access can't open the database

VBscript in Data Access Pages

     
5:58 pm on Dec 6, 2004 (gmt 0)

New User

10+ Year Member

joined:Oct 18, 2004
posts:6
votes: 0


Hi! I just started to work with data acces pages and I need some help.

I have a database(mdb) in a web server and the users will access it by internet(IE) using data access pages. I have no problems to access data, add, edit or delete. The probem happens when I try to use a button to print a report. I've been getting this error message, no matter what I try: Microsoft Access can't open the database because it is missing, or opened exclusively by another user.

The code I'm using is:

-------------------------------------
<SCRIPT language=vbscript event=onclick for=ButtonPrintEnvelope>
<!--

Dim objAcc
Dim strcodecustomer

strcodecustomer = MSODSC.DataPages(0).Recordset.Fields("ID")

Set objAcc = CreateObject("Access.Application")
objAcc.OpenCurrentDatabase "C:\Database\Test.mdb"
objAcc.DoCmd.OpenReport "Envelope", , , "id = " & strcodecustomer

-->
</SCRIPT>
-------------------------------------
Does anybody know what I'm doing wrong? Maybe it is the way I'm expressing the path of the database, but I've tried everything I know.

PLEASE HELP!

Thanks in advance,

Kiko

5:52 pm on Dec 8, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member trillianjedi is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 15, 2003
posts:7242
votes: 0


<cough>

Anyone? I would have thought we'd have an Access expert among us somewhere...?

TJ

6:28 pm on Dec 8, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 28, 2004
posts:1786
votes: 0


This is why I have my developers, but you might have a quicker response in the Microsoft Related - .NET and ASP forum: [webmasterworld.com...]

-Corey

6:32 pm on Dec 8, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 29, 2002
posts:980
votes: 0


Not used Data Access Pages, but I have seen this error message in asp pages when the database and/or Access is still open on the local workstation.

Do you still get the problem when you've come right out of Access?

1:21 pm on Dec 9, 2004 (gmt 0)

New User

10+ Year Member

joined:Oct 18, 2004
posts:6
votes: 0


Hello!

I still didn't figure out what is going on. I'm sure the database is not open when I try to print the report.

I'm pretty sure that the problem is finding the database (path). We don't have physical access to the server (only remote access). Does anybody have an idea on how to do that?

Thanks in advance.

Kiko

1:27 pm on Dec 9, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 29, 2002
posts:980
votes: 0


You can check the remote server path with:

<%
Response.write(Server.MapPath("/"))
%>
11:48 pm on Jan 4, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 9, 2004
posts:133
votes: 12


there's an access lock file that's in place but shouldn't be I think. Yet another reason not to use access for web based applications. Sometimes it's also a permissions problem, it's hard to say, depends on the hoster, some of them really restrict what you can do with access.

Access is great for secretaries keeping their mailing lists for mail merge, but it's a horrible product for working with on websites, the sooner you switch to a real db, the happier you'll be.