I'm sorry about this, but I don't know how else to go about it, so I really hope this helps.
This deals with 2 pages:
ResearcherStaffPatents.asp - which is where I want to be able to Add or Edit records.
ResearcherStaffPatent_AddEdit.asp - which has a listing of all of a participants patents and they may chose to delete or add or
edit a particular patent.
Below is the code on page ResearcherStaffPatents.asp. It is being 'called' by ResearcherStaffPatent_AddEdit.asp by using a
querystring action, like so:
<a href="ResearcherStaffPatents.asp?action=edit&id=<%= rst.Fields("Patentid").Value %>">Edit</a>
<a href="ResearcherStaffPatents.asp?action=delete&id=<%= rst.Fields("Patentid").Value %>">Delete</a>
<a href="ResearcherStaffPatents.asp?action=add">Add a new record</a>
**********************************************************************************
**ResearcherStaffPatents.asp**
<<connection info, DIM's, etc>>
strAction = LCase(Trim(Request.QueryString("action")))
SELECT CASE strAction
CASE "edit"
<<this works>>
CASE "delete"
<<this works>>
CASE "add"
strSQL = "SELECT * " 'using * until this works
strSQL = strSQL & "FROM tblPatents "
strSQL = strSQL & "WHERE PatentID = 0;"
'-----------------------------------------------------------
Set rst = server.CreateObject("ADODB.Recordset")
rst.Open strSQL, cnMain, 1, 3, &H0001
rst.AddNew
rst.Fields("ParticipantID") = intParticipantID
rst.Fields("PatentYear") = ""
rst.Fields("PatentNumber") = ""
rst.Fields("PatentTitle") = ""
rst.Fields("PatentStatus") = ""
rst.Fields("CampusIPO") = 0
rst.Fields("Authors") = ""
rst.Update
CASE Else
'do nothing
END SELECT
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM action="ResearcherStaffPatent_AddEdit.asp" method=post id=ResearcherStaffPatents_AddEdit
name=ResearcherStaffPatents_AddEdit>
<P><FONT face=Arial><STRONG>PATENTS</STRONG></FONT></P><BR>
<P><FONT face=Arial size=2>Report only those patents awarded since January 1, 2001
acknowledging EPSCoR support. Do not report patents that are "pending". List all
staff who participated in patent writing.</FONT></P>
<P>
<TABLE cellSpacing=2 cellPadding=4 width="90%" border=0>
<TR>
<TD><STRONG> Patent Year: </STRONG><INPUT id="txtPatentYear"
style="WIDTH: 100px; HEIGHT: 22px" size=59 value="<%=rst("PatentYear")%>" name="txtPatentYear" tabindex="1"></TD></TR>
<TR>
<TD><STRONG>Patent Number: </STRONG><INPUT id="txtPatentNumber"
style="WIDTH: 461px; HEIGHT: 22px" size=59 value="<%=rst("PatentNumber")%>" name="txtPatentNumber" tabindex="2"></TD></TR>
<TR>
<TD><STRONG>
Patent Title: </STRONG><INPUT id="txtPatentTitle"
style="WIDTH: 461px; HEIGHT: 22px" size=59 value="<%=rst("PatentTitle")%>" name="txtPatentTitle" tabindex="3"></TD></TR>
<TR>
<TD> <STRONG>Patent Status:</STRONG>
<INPUT id="radPatStatusApplied" type="radio" value="applied" name="radPatentStatus" tabindex="4" <%If
rst("PatentStatus")="applied" Then%>checked<%End If%>> Applied For
<INPUT id="radPatStatusGranted" type="radio" value="granted" name="radPatentStatus" tabindex="5" <%If
rst("PatentStatus")="granted"Then%>checked<%End If%>> Granted</TD></TR>
<TR>
<TD><STRONG>Was the Patent Application through the Campus Intellectual Property Office?</STRONG>
<INPUT id="radCampusIPOYes" type="radio" value="Yes" name="radCampusIPO" tabindex="6" <%If rst("CampusIPO")= True
Then%>checked<%End If%>> Yes
<INPUT id="radCampusIPONo" type="radio" value="No" name="radCampusIPO" tabindex="7" <%If rst("CampusIPO")= False
Then%>checked<%End If%>> No</TD></TR>
<TR>
<TD><STRONG>
Authors: </STRONG><INPUT id="txtAuthors"
style="WIDTH: 462px; HEIGHT: 22px" size=59 value="<%=rst("Authors")%>" name="txtAuthors" tabindex="8"></TD></TR>
</TABLE></P>
<P align=center>Please click on Submit to continue to the appropriate links to submit additional required
information.</P>
<P align="center">
<TABLE cellSpacing="1" cellPadding="1" width="50%" border="1">
<TR>
<TD>
<P align="center"><INPUT type=button id=submit1 name=submit1 value=Submit
onclick="location.href='ResearcherStaffPatent_AddEdit.asp?action=<%=strAction%>'"></P>
</TD>
<TD>
<P align="center"><INPUT id=reset1 type=reset value=Reset name=reset1></P>
</TD>
<TD>
<P align="center"><INPUT type=button id=Home name=Home value=Home onclick="location.href='home_rs.asp'"></P>
</TD>
<TD>
<P align="center"><INPUT type=button id=Logout name=Logout value=Logout onclick="location.href='Logout.asp'"></P>
</TD>
</TR>
</TABLE></P>
*********************************************************************************
<<And here is where I am stuck>>
If I use this the way Case "add" stands now, I will enter a new record, with no data except for the PatentID and ParticipantID,
just by clicking the <Add New Record> button from ResearcherStaffPatent_AddEdit.asp with no way to delete it if I leave the
ResearcherStaffPatents.asp page for some reason (I think, but I am quite new to .asp).
If I remove (comment out) all the references to the .AddNew rst.Fields("xxx") and try and use the empty recordset as the Record
Source to ResearcherStaffPatents.asp I get the error I mentioned in my first post. ( Either BOF or EOF is True, or the current
record has been deleted. Requested operation requires a current record.)
If I bypass the SQL statement, i.e. by just opening the form, the page error I get is, Type mismatch: 'rst', and then gives a
line number which references the 'rst' in the value criteria of txtPatentYear.
I hope this will give an idea of what I am trying to do and the problems I am having doing it.
Thank you.
gdr
[quoted text, click to view] "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:OFplNRjVDHA.612@TK2MSFTNGP10.phx.gbl...
> Okay, so then what are you stuck on? How to get the column names from the
> table? How to insert a record? Are you getting an error? What code do you
> have so far?
>
> Ray at home
>
> --
> Will trade ASP help for SQL Server help
>
>
> "Gary D. Rezek" <Gary_Rezek@NOSPAMsdstate.edu> wrote in message
> news:u$wU5RhVDHA.3924@tk2msftngp13.phx.gbl...
> > Hi Ray,
> > I'm trying to setup a page somewhat based on the ASP101 Database Editing
> sample
> >
http://www.asp101.com/samples/db_edit.asp (using asp source code)
> > Where they are building a page (form) to do the edit and AddNew procedures