bjzielinski
IS-IT--Management
I am creating a front end for a MSAccess database. I have a form that inputs data into the database. What I want to do is have the user input the data into the fields, press the Add button and then a message box pops up saying the information was added, then clear out the boxes so another record can be added. Here are a few lines of my code:
<script language="VBScript">
<!-- start of VBscript hide from old browsers
Sub add_OnClick()
set conn = Server.CreateObject("ADODB.Connection"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("../fpdb/tax.mdb"
& ";"
strsql = "SELECT * FROM forclosed WHERE recNo=0;"
set rs = Server.CreateObject("ADODB.Recordset"
rs.Open strsql, conn, 1, 2
...
rs.AddNew
rs.Fields("ID1"
.Value = newForm.ID1.value
rs.Fields("ID2"
.Value = newForm.ID2.value
...
End Sub
-->
</script>
...
<Form name=newForm>
...
<TD vAlign=top align=right>Minimum Bid:</TD>
<TD><input type=text name=minbid size=30></TD>
...
<TD><input type=button name=add value=Add><input type=reset name=reset value=Clear>
Unfortunately this does nothing. The debugger says something about the Server mode not being handled when the sub procedure runs. However when I run it in just IE, nothing happens, no error, the sub procedure doesn't even seem to run. If anybody has an easy way to clear out the fields let me know. There's probably a simple command I'm missing, other than pressing the Clear button. Bill Zielinski
bzielinski@co.midland.mi.us
County of Midland, Michigan
<script language="VBScript">
<!-- start of VBscript hide from old browsers
Sub add_OnClick()
set conn = Server.CreateObject("ADODB.Connection"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("../fpdb/tax.mdb"
strsql = "SELECT * FROM forclosed WHERE recNo=0;"
set rs = Server.CreateObject("ADODB.Recordset"
rs.Open strsql, conn, 1, 2
...
rs.AddNew
rs.Fields("ID1"
rs.Fields("ID2"
...
End Sub
-->
</script>
...
<Form name=newForm>
...
<TD vAlign=top align=right>Minimum Bid:</TD>
<TD><input type=text name=minbid size=30></TD>
...
<TD><input type=button name=add value=Add><input type=reset name=reset value=Clear>
Unfortunately this does nothing. The debugger says something about the Server mode not being handled when the sub procedure runs. However when I run it in just IE, nothing happens, no error, the sub procedure doesn't even seem to run. If anybody has an easy way to clear out the fields let me know. There's probably a simple command I'm missing, other than pressing the Clear button. Bill Zielinski
bzielinski@co.midland.mi.us
County of Midland, Michigan