views:

571

answers:

6

I have been toying around with the idea of enabling an html and javascript file to read MS Access database records. I understand that the database will have to sit on the client for the html/JS file to read it. However, after some successful tests, I notice that just the front-end of the Access database has to be available on the client for the html/JS file to read the tables, as long as the MS Access front-end can access the tables, which would be split and located on a networked server.

With that said, I was able to add records to the MS Access database with the following code:

function AddRecord()
{
  var adoConn = new ActiveXobject("ADODB.Connection");
  var adoRS = new ActiveXobject("ADODB.Recordset");

  adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\\... to Db front-end'");
  adoRS.Open("Select SomeTable.* From SomeTable", adoConn, 1, 3);

  alert('adoRs');
  adoRS.Close();
  adoConn.Close();
}

This function is executed with an html textbox and button. Instead of adding a record, I was wondering if anyone knew how to display an MS Acecess record either in an html textbox or alert box using a Javascript function?

A: 

Why dig yourself in a hole and open up security problems. Learn a little bit on any serverside language and access it that way.

If you really want to do it you can use this library: http://www.accessdb.org/ that makes it easier to access and read it.

epascarello
Thanks Epascarello - This project would only be used internally with a few people who have access to the network drive where the Db tables sit so security, at least in this environment, wouldn't be an issue. However, I agree with you about using a server-side language. Because of the small scope of this project, I do not want to deal with crating and installing an application, but rather write one in NotePad and package it with the Db front-end.Thanks again,DFM
Look at that JavaScript library than, it seems to do a lot of the dirty work for you.
epascarello
A: 

You may want to wait a while for html 5, which includes some database-like storage on the client side. This site has a compatibility table that is fairly recent.

If you really want to have the data stored between multiple users, epascarello is correct, and you really should move such code to server-side.

krdluzni
A: 

If you're going to put an Access front-end on the user's computer to get the html/js solution to work, why not just do what you need to do in the Access front-end instead of trying to get html/js to do it?

KevenDenen
Wouldn't that require having Access installed? Looks to me like the .mdb file is just a source and has nothing to do with the application at all.
Jeff O
You can install the free Access runtime on the machine.
KevenDenen
Hello Keven - The html/JS file would act as an intermediary between multiple Access Db's. This file would also search through network drives for specific files, run applications and other databases available to the end-user, perform certain formulas, etc... The html/JS file would perform many features beyond what the Access front-end could do.Thanks,Damion
+1  A: 

In addition to the previously mentioned Accessdb Jackcess is a pure Java library for reading from and writing to MS Access databases. http://jackcess.sourceforge.net/ Note that I know next to nothing about Java or how suitable this might be for your project.

Tony Toews
It's for Jet/ACE databases. It doesn't know anything about Access (not that the OP here needs anything more than that).
David-W-Fenton
A: 

Instead of using the front end, why not check the connect string of the table in the front end that you want to work with, and use the back end MDB directly in your ADO connect string?

I'm having some difficulty understanding why your user's PCs have Access front ends on them if they don't have Access installed. An Access front end has nothing in it that can be used without Access itself.

David-W-Fenton
Hello David - The end-users do have Access installed and the front-end is basically a general Db front-end; however, the html/JS file would be an integrated application that reads multiple Access Dbs, as well as runs multi applications, locates specific folders and files throughout an extnesive drive network, and other features. It's kind of like having an OS on your OS, but rendered in a web browser. In other words, the html/JS file would act as a table of content for everything available from the end-users thin-client. It's work in progress.Thanks,DFM
OK, sounds interesting. But you still don't need to use the front ends except as a way to locate the back ends that have the real data you're interested in.
David-W-Fenton
A: 

Thank you for the answer

wasiu
Thank *who* for *what* answer?
David-W-Fenton