Forums

ASP

This topic is locked

Submitting Blank fields from Forms

Posted 22 Apr 2008 22:51:30
1
has voted
22 Apr 2008 22:51:30 Mark Maldonado posted:
I am having a problem submitting blank fields into an access database. Is there a way to submit the form from html using asp code to submit the info to the database. I have it working but all fields need to be filled in...I want there to be an option to have the field occupied or not....

Here is what my script looks like

<%

Dim adoCon
Dim AddCat

Set adoCon = Server.CreateObject("ADODB.Connection"

adoCon.Open Provider="Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("test.mdb"

Set AddCat = Server.CreateObject("ADODB.Connection"

strSQL = "SELECT tblCat.Small, tblCat.Medium, tblCat.Large, tblCat.Huge FROM tblCat;"

AddCat.CursorType = 2

AddCat.LockType = 3

AddCat.Open strSQL, adoCon

AddCat.AddNew

AddCat.Fields("Small" = Request.Form("small"
AddCat.Fields("Medium" = Request.Form("medium"
AddCat.Fields("Large" = Request.Form("large"
AddCat.Fields("Huge" = Request.Form("huge"

AddCat.Update

AddCat.Close

Set AddCat = Nothing
Set adoCon = Nothing

Response.Redirect "cats.asp"

%>

Replies

Replied 23 Apr 2008 00:48:51
23 Apr 2008 00:48:51 student 101 replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>I have it working but all fields need to be filled in...I want there to be an option to have the field occupied or not....<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

There is an option is MS Access for this.
It's in the database fields section, you can specify whether or not to have the field be filled.

It's in design view of the table under "Required" = Yes or No



[DWMX 2004]|[DWMX 8]|[DW CS3]|[MySQL]|[SQL]|[Access ]|[ASP/VBScript]|[PHP]|[XP-Pro]

Reply to this topic