Hello

I have a page here Displaying all records from a database table

which, when the pop-up form is completed/submitted, should add a record to the table (MS Access 2003), but doesn't - not even when I refresh the page - and I can't figure out why. I don't get any error messages.

The stripped code looks like this:

Code:
<% 

 Dim Connection, Recordset
 Dim sSQL, sConnString
 Dim fullName, wolfID, telNo, address, email, description, received, action, dispatched


sSQL="INSERT INTO tblWolf " &_
 "(fullName, wolfID, telNo, address, email, description, received, [action], dispatched)" &_
 " VALUES ('" & my_fullName & "', " & my_wolfID & ", " & my_telNo & ", '" & address & "', '" & my_email & "', '" & my_description & "', #" & my_received & "#, '" & my_action & "', '" & my_dispatched & "')"

sSQL="SELECT TOP 20 ID, fullName, wolfID, telNo, address, email, description, received, action, dispatched FROM tblWolf ORDER BY ID DESC"

sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _ 
"Data Source=" & "E:\clients.mdb"

Set connection = Server.CreateObject("ADODB.Connection")
Set recordset = Server.CreateObject("ADODB.Recordset")

connection.Open sConnString

recordset.Open sSQL,connection

response.write "<table class='myTable'>"

%>

<%

If Recordset.EOF Then
Response.Write "<tr><td>No records returned.</td></tr>"
 Else
Do While Not recordset.EOF

Response.Write "<tr><td>" & recordset("ID") & "</td>"
Response.Write "<td>" & recordset("fullName") & "</td>"
Response.Write "<td>" & recordset("wolfID") & "</td>"
Response.Write "<td>" & recordset("telNo") & "</td>"
Response.Write "<td>" & recordset("address") & "</td>"
Response.Write "<td>" & recordset("email") & "</td>"
Response.Write "<td>" & recordset("description") & "</td>"
Response.Write "<td>" & recordset("received") & "</td>"
Response.Write "<td>" & recordset("action") & "</td>"
Response.Write "<td>" & recordset("dispatched") & "</td></tr>" 

 Recordset.MoveNext
 Loop

 response.write "</table>"
 End If
%>

<% 
Dim conn, rs, my_fullName, my_wolfID, my_telNo, my_address, my_email, my_description, my_received, my_action, my_dispatched

my_fullName = Replace( Request.Form("fullName"), "'", "''" )
my_wolfID = CDBL( Request.Form("wolfID") )
my_telNo = CDBL( Request.Form("telNo") )
my_address = Replace( Request.Form("address"), "'", "''" )
my_email = Replace( Request.Form("email"), "'", "''" )
my_description = Replace( Request.Form("description"), "'", "''" )
my_received = CDATE( Request.Form("received") )
my_action = Replace( Request.Form("action"), "'", "''" )
my_dispatched = Replace( Request.Form("dispatched"), "'", "''" )

connection.Execute sSQL

Response.write "<div align='center'><p class='font'>The record has been added.</p></div>"

connection.Close
 
Set connection = Nothing
%>

<form action="display_recordsTEST1.asp" method="post">
etc

Is the problem because I am trying to add records to a database that is closed? If so, how would I rearrange the code, please?

Thanks