How to connect to a local mdb via ADO and VBScript?

P

Peter Wetschnigg

Hello,

I have a Access 2000 database which contains one single table locally
stored on my harddisk. What I am trying to accomplish is to access the data
in this table via a html document. (Sort of html-frontend for Access.) I
have heard that this can be done using an ADO data connection, e.g. with
VBScript. Searching google only reveiled explanations on how this would be
done with a remote database but for a locally stored database I couldn't
find anything or only general statements that it's possible, but no
detailed description of how this would be done.
If anyone could give an example on this subject, it would be highly
appreciated.

Best regards
Peter W.
 
P

Peter Wetschnigg

Am Fri, 25 Feb 2005 17:36:27 -0500 schrieb "Douglas J. Steele"
Actually, I wouldn't have thought it was possible for remove databases.

Carl Prothman has the necessary connection strings defined at
http://www.able-consulting.com/ado_conn.htm

Thank you. I have tried this and my html-document now looks like this:

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

<html>
<head>
<title>Test</title>
</head>

<body>
<script type="text/vbscript">

Dim oRS
Dim oConn

Set oConn = CreateObject("ADODB.Connection")
Set oRS = CreateObject("ADODB.Recordset")

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=MyDatabase.mdb;" & _
"Uid=admin;" & _
"Pwd="

oRS.Open "Select * FROM Table1", oConn, 1, 3

MsgBox oRs.RecordCount

oConn.Close
Set oConn = Nothing
</script>

</body>
</html>

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

The Problem now is: When I open this document in internet explorer, it
crashes. But when I copy the script-part of the above document into a
..vbs-file, it works perfecty (i.e. a MsgBox pops up showing the number of
records in table1).
Now I am wondering, why it doesn't work from within IE?

Best regards
Peter W.
 
D

Douglas J. Steele

Where is the database? You've only got MyDatabase.mdb: you probably need to
qualify that.
 
P

Peter Wetschnigg

Am Fri, 25 Feb 2005 21:19:14 -0500 schrieb "Douglas J. Steele"
Where is the database? You've only got MyDatabase.mdb: you probably need to
qualify that.

The database and the html-document are in the same directory.

Peter W.
 
D

Douglas J. Steele

Peter Wetschnigg said:
Am Fri, 25 Feb 2005 21:19:14 -0500 schrieb "Douglas J. Steele"


The database and the html-document are in the same directory.

Sorry, I've never actually tried to use HTML in that manner (all my
web-based interactions with Jet databases have been with ASP, and the
database was on the server)

Hopefully someone else will chime in with suggestions. If not, try reposting
your question (clearly marking it as a repost)
 
P

Peter Wetschnigg

Am Sat, 26 Feb 2005 06:48:11 -0500 schrieb "Douglas J. Steele"
Sorry, I've never actually tried to use HTML in that manner (all my
web-based interactions with Jet databases have been with ASP, and the
database was on the server)

Hopefully someone else will chime in with suggestions. If not, try reposting
your question (clearly marking it as a repost)

I've found the answer. It can't be done directly from a html-document for
security reasons. I had to use HTML-Applications (HTA). Having renamed my
html-document to hta, everything works fine.

Best regards,
Peter W.
 

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