The problem is that I cannot get my Add Products to work. Below is the source coding for both the entry form and the .asp processing. Can anyone tell me what is wrong with this code? Help is greatly appreciated, and so is a final solution! I'll add reputation to whoever can get this working for me. Oh, and it uses the Northwind.mdb sample that came with Access 2003.

(ENTRY FORM) - FILENAME: myindex.html

<html>
<body>

<form method="post" action="product_append.asp">
<table>
<tr>
<td>Product ID:</td>
<td><input name="prodid"></td>
</tr><tr>
<td>Company Name:</td>
<td><input name="prodname"></td>
</tr><tr>
<td>Supplier ID:</td>
<td><input name="suppid"></td>
</tr><tr>
<td>Category ID:</td>
<td><input name="catid"></td>
</tr><tr>
<td>Quantity of Stock:</td>
<td><input name="quantity"></td>
</tr><tr>
<td>Unit Price:</td>
<td><input name="unitprice"></td>
</tr><tr>
<td>Unit Stock:</td>
<td><input name="unitstock"></td>
</tr><tr>
<td>Units On Order:</td>
<td><input name="unitorder"></td>
</tr><tr>
<td>Reorder Level:</td>
<td><input name="reorderlevel"></td>
</tr>
</table>
<br /><br />
<input type="submit" value="Add New"> 
<input type="reset" value="Cancel">
</form>

</body>
</html>

(ASP PROCESSING) - FILENAME: product_append.asp

<html>
<body>

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/northwind.mdb"

sql="INSERT INTO Products (Product_ID,Product_Name,"
sql=sql & "Supplier_ID,Category_ID,Quantity_Per_Unit,Unit_Price,Units_In_Stock,Units_On_Order,Reorder_Level)"
sql=sql & " VALUES "
sql=sql & "'" & Request.Form("prodid") & "',"
sql=sql & "'" & Request.Form("prodname") & "',"
sql=sql & "" & Request.Form("suppid") & ","
sql=sql & "" & Request.Form("catid") & ","
sql=sql & "'" & Request.Form("quantity") & "',"
sql=sql & "'" & Request.Form("unitprice") & "',"
sql=sql & "" & Request.Form("unitstock") & ","
sql=sql & "" & Request.Form("unitorder") & ","
sql=sql & "" & Request.Form("reorderlevel") & ")"

'on error resume next
conn.Execute sql,recaffected
'if err<>0 then
  Response.Write("No update permissions!")
'else 
  Response.Write("<h3>" & recaffected & " record added</h3>")
'end if
conn.close
%>

</body>
</html>

The only issue that I see is that your Form is on a different page, so Request.Form won't work in your case. Try replacing Request.Form with Request.Querystring.

When the submit button on myindex.html is clicked, it should send all of your name="value" pairs to product_append.asp through querystrings.

IOW, With no values in any of the textboxes, you should see something like this in your address bar after you've clicked the Add New button:

/product_append.asp?prodid=&prodname=&suppid=&catid=&quantity=&unitprice=&unitstock=&unitorder=&reorderlevel&Submit=Add+New

The only problem with using this method is that you're limited to the MAXLENGTH of the characters allowed in the addressbar.

Good Luck!

Thanks, I'll give it a shot.

Actually, the request.form will work perfectly fine as your form is set to the action of your processing page. The problem you are incurring is dealt by the limited information on your form page. Your input fields should be a minimum of this:
<input type="text" name="name">

Should be this:
<input type="text" name="name" id="name">

Since your input fields are not set to a type, it doesn't know exactly what to request.

Also you shouldn't add your form elements directly into the query. Declare your variables first then add the variables in. I have redone your information so please plug-in-play.

Entry page:

<html>
<body>

<form method="post" action="product_append.asp">
<table>
<tr>
<td>Product ID:</td>
<td><input type="text" id="prodid" name="prodid"></td>
</tr><tr>
<td>Company Name:</td>
<td><input type="text" id="prodname" name="prodname"></td>
</tr><tr>
<td>Supplier ID:</td>
<td><input type="text" id="suppid" name="suppid"></td>
</tr><tr>
<td>Category ID:</td>
<td><input type="text" id="catid" name="catid"></td>
</tr><tr>
<td>Quantity of Stock:</td>
<td><input type="text" id="quantity" name="quantity"></td>
</tr><tr>
<td>Unit Price:</td>
<td><input type="text" id="unitprice" name="unitprice"></td>
</tr><tr>
<td>Unit Stock:</td>
<td><input type="text" id="unitstock" name="unitstock"></td>
</tr><tr>
<td>Units On Order:</td>
<td><input type="text" id="unitorder" name="unitorder"></td>
</tr><tr>
<td>Reorder Level:</td>
<td><input type="text" id="reorderlevel" name="reorderlevel"></td>
</tr>
</table>
<br /><br />
<input type="submit" name="submit" id="submit" value="Add New"> 
<input type="reset" name="reset" id="reset" value="Cancel">
</form>

</body>
</html>
Processing page:

<%
Dim strProdid = Trim(Request.Form("prodid"))
Dim strProdname = Trim(Request.Form("prodname"))
Dim strSuppid = Trim(Request.Form("suppid"))
Dim strCatid = Trim(Request.Form("catid"))
Dim strQuantity = Trim(Request.Form("quantity"))
Dim strUnitprice = Trim(Request.Form("unitprice"))
Dim strUnitstock = Trim(Request.Form("unitstock"))
Dim strUnitorder = Trim(Request.Form("unitorder"))
Dim strReorderlevel = Trim(Request.Form("reorderlevel"))

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/northwind.mdb"

sql="INSERT INTO Products (Product_ID,Product_Name,"
sql=sql & "Supplier_ID,Category_ID,Quantity_Per_Unit,Unit_Price,Units_In_Stock,Units_On_Order,Reorder_Level)"
sql=sql & " VALUES "
sql=sql & "'" & strProdid & "',"
sql=sql & "'" & strProdname & "',"
sql=sql & "" & strSuppid & ","
sql=sql & "" & strCatid & ","
sql=sql & "'" & strQuantity & "',"
sql=sql & "'" & strUnitprice & "',"
sql=sql & "" & strunitstock & ","
sql=sql & "" & strUnitorder & ","
sql=sql & "" & strReorderlevel & ")"

'on error resume next
conn.Execute sql,recaffected
'if err<>0 then
  Response.Write("No update permissions!")
'else 
  Response.Write("<h3>" & recaffected & " record added</h3>")
'end if
conn.close
%>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.