PDA

View Full Version : Is it possible?


Mojeaux65
02-18-2006, 03:00 PM
Hi Guys,
Found you on a Google Search! I have I like to think is unique problem.

Question: Is it possible to access/modify/add/update records in a MS Access 97 database using VBscript in a plain HTML page?

The reason I ask is... most everything... rephrase... everything I found thus far has been related to ASP. Active Server Pages are not an option for me because the HTML page and database reside on a data server on a LAN.
Our goal is to update records in an existing db when employees submit a HTML page. Currently we have a clerk rekeying the data into the database.

I have some javascript/vb.net/vba experience... but accessing a databse is new to me. I made a feeble attempt to modify some code I found on the internet to test with our data... as it turns out it was VBA! lol (here's the code).

<html>
<head>
<SCRIPT language="VBScript">
Dim dbMyDB
Dim rsMyRS
Dim rsName, rsEmail, rsPhone, rsStatus, rsDate, rsNote

Set dbMyDB = OpenDatabase("\\SRPEGA04\TESTDB\PROJ1.MDB")
Set rsMyRS = dbMyDB.OpenRecordSet("Proj1", dbOpenDynaset)
Set rsName = myform.Name.value
Set rsEmail = myform.Email.value
Set rsPhone = myform.Phone.value
Set rsStatus = myform.Status.value
Set rsDate = myform.Date.value
Set rsNote = myform.Note.value

Sub Add_newrec()
rsMyRS.AddNew
rsMyRS = rsName
1stRecords.AddItem rsMyRS!Name
1stRecords.ItemData(1stRecords.NewIndex) = rsMyRS!ID
rsMyRS!Phone = rsPhone
rsMyRS.Update
End Sub
</Script>
</head>
<body>
<form name="myform">
Name: <input type="text" name="Name" size="50"><br>
E-mail: <input type="text" name="Email" size="50"><br>
Phone: <input type="text" name="Phone" size="50"><br>
Status: <input type="text" name="Status" size="50"><br>
Date: <input type="text" name="Date" size="50"><br>
Note: <input type="text" name="Note" size="50"><br>
<input type="submit" value="Submit" name="B1" onClick="Add_newrec()">
<input type="reset" value="Reset" name="B2">
</form>
</body>
</html>

If anyone has had any success with this, I would love to hear from you! Or if you know of any non-ASP reference websites that deal specifically with this, please share them. Thank you for your time!