473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Form Data not carrying over???

I have the following in a page and I am trying to update a record on
the next page but for some reason the form data is not carrying over.
Any ideas why?

<form name=nxtlupdate method=post action=supers_NxtlUpdate.asp>

<%

Do While Not objRecordset.EOF

Response.Write "<tr>"
Response.Write "<td align=center valign=top><input
type=text name=ContactName size=15 value='" &
objRecordset("ContactName") & "'></td>"
Response.Write "<td valign=top align=center><input
type=text name=Radio size=4 value='" & objRecordset("Radio") &
"'></td>"
Response.Write "<td valign=top align=center><input
type=text name=Mobile size=10 value='" & objRecordset("Mobile") &
"'></td>"
Response.Write "<td valign=top align=center><a
href=supers_nxtlUpdate.asp?ID="
Response.Write objRecordset("Id") & ">Update</a></td>"

Response.Write "</tr><tr><td colspan=6><hr></td></tr><tr>"

objRecordset.MoveNext
Loop

objRecordset.Close

%>
</form>

***** Second Page: *****

<%
dim strContactName, strRadio
dim strMobile, strID

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\nextel.mdb"

Set objRecordset = Server.CreateObject ("ADODB.Recordset")

objRecordset.Open "tblContactList", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable

strID = Request.QueryString("ID")

strContactName = Request.Form("ContactName")
strRadio = Request.Form("Radio")
strMobile = Request.Form("Mobile")

objRecordset.Filter = "ID='" & strID & "'"

objRecordset("ContactName") = strContactName
objRecordset("Radio") = strRadio
objRecordset("Mobile") = strMobile
objRecordset.Update
objRecordset.Close
set objRecordset = Nothing

%>

Apr 27 '06 #1
4 2129

Matt wrote:
I have the following in a page and I am trying to update a record on
the next page but for some reason the form data is not carrying over.
Any ideas why?

<form name=nxtlupdate method=post action=supers_NxtlUpdate.asp>

<%

Do While Not objRecordset.EOF

Response.Write "<tr>"
Response.Write "<td align=center valign=top><input
type=text name=ContactName size=15 value='" &
objRecordset("ContactName") & "'></td>"
Response.Write "<td valign=top align=center><input
type=text name=Radio size=4 value='" & objRecordset("Radio") &
"'></td>"
Response.Write "<td valign=top align=center><input
type=text name=Mobile size=10 value='" & objRecordset("Mobile") &
"'></td>"
Response.Write "<td valign=top align=center><a
href=supers_nxtlUpdate.asp?ID="
Response.Write objRecordset("Id") & ">Update</a></td>"

Response.Write "</tr><tr><td colspan=6><hr></td></tr><tr>"

objRecordset.MoveNext
Loop

objRecordset.Close

%>
</form>

***** Second Page: *****

<%
dim strContactName, strRadio
dim strMobile, strID

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\nextel.mdb"

Set objRecordset = Server.CreateObject ("ADODB.Recordset")

objRecordset.Open "tblContactList", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable

strID = Request.QueryString("ID")

strContactName = Request.Form("ContactName")
strRadio = Request.Form("Radio")
strMobile = Request.Form("Mobile")

objRecordset.Filter = "ID='" & strID & "'"

objRecordset("ContactName") = strContactName
objRecordset("Radio") = strRadio
objRecordset("Mobile") = strMobile
objRecordset.Update
objRecordset.Close
set objRecordset = Nothing

%>


The values are not being passed because you aren't submitting the form.
You have no <input type="submit"> anywhere.

--
Mike Brind

Apr 28 '06 #2
OK, From what i can tell from your script is that you want a basic form
to enter in new customer equiptment into a database. I can see that you
want to enter in new data everytime you access this page, you are not
looking to update a customer record but enter in a new record.

You had a Request.QueryString and Request.Form when you don't need to..
Also I am gathering that you have a database string that pulls the ID
for objRecordSet("ID") when the page opens. If you don't have the
database autopopulating the ID? From what i can tell you don't have it
and that makes a big differnce. If you don't have the ID autopopulate.
Below are two examples. One with Access populating the ID and one
without

You also had your access values surrounded '" & objRecordSet() & "'
When the proper way is. only " & objRecordSet() & "
------------------------------ Without Auto Populate
-------------------------------------------

<form name=nxtlupdate method=post action=supers_NxtlUpdate.asp>
<%
Do While Not objRecordset.EOF
Response.Write "<tr><td align=center valign=top><input type=text
name=id></td></tr>"
Response.Write "<tr><td align=center valign=top><input type=text
name=ContactName size=15></td></tr>"
Response.Write "<tr><td valign=top align=center><input type=text
name=Radio size=4></td></tr>"
Response.Write "<tr><td valign=top align=center><input type=text
name=Mobile size=10></td></tr>"
Response.Write "<tr><td valign=top align=center><input type=submit
name=submit value=Update><input type=reset name=reset
value=reset></td></tr>"
Response.Write "<tr><td colspan=6><hr></td></tr>"
objRecordset.MoveNext
Loop
objRecordset.Close
%>
</form>
--------------------Next Page--------------------------
<%
Dim strID
Dim strConnect
Dim objRecordSet

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\nextel.mdb"
Set objRecordset = Server.CreateObject ("ADODB.Recordset")
objRecordset.Open "tblContactList", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable
objRecordSet.AddNew ------------------------------- Only Add This if
you are trying to enter a new record for each instance of a customer
record
strID = Request.Form("ID")

objRecordset.Filter = "ID='" & strID & "'"
objRecordset("ContactName") = Request.Form("ContactName")
objRecordset("Radio") = Request.Form("Radio")
objRecordset("Mobile") = Request.Form("Mobile")
objRecordset.Update
objRecordset.Close
set objRecordset = Nothing
%>

------------------------------------------ Auto Populate ID from Access
-----------------------------------
<form name=nxtlupdate method=post action=supers_NxtlUpdate.asp>
<%
Do While Not objRecordset.EOF
Response.Write "<tr><td align=center valign=top><input type=hidden
disabled name=id value=" & objRecordset("Id") & "></td></tr>"
Response.Write "<tr><td align=center valign=top><input type=text
name=ContactName size=15 value=" & objRecordset("ContactName") &
"></td></tr>"
Response.Write "<tr><td valign=top align=center><input type=text
name=Radio size=4 value=" & objRecordset("Radio") & "></td></tr>"
Response.Write "<tr><td valign=top align=center><input type=text
name=Mobile size=10 value=" & objRecordset("Mobile") & "></td></tr>"
Response.Write "<tr><td valign=top align=center><input type=submit
name=submit value=Update><input type=reset name=reset
value=reset></td></tr>"
Response.Write "<tr><td colspan=6><hr></td></tr>"
objRecordset.MoveNext
Loop
objRecordset.Close
%>
</form>
--------------------Next Page--------------------------
<%
Dim strID
Dim strConnect
Dim objRecordSet

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\nextel.mdb"
Set objRecordset = Server.CreateObject ("ADODB.Recordset")
objRecordset.Open "tblContactList", strConnect, adOpenStatic,
adLockOptimistic, adCmdTable
objRecordSet.AddNew ------------------------------- Only Add This if
you are trying to enter a new record for each instance of a customer
record
strID = Request.Form("ID")

objRecordset.Filter = "ID='" & strID & "'"
objRecordset("ContactName") = Request.Form("ContactName")
objRecordset("Radio") = Request.Form("Radio")
objRecordset("Mobile") = Request.Form("Mobile")
objRecordset.Update
objRecordset.Close
set objRecordset = Nothing
%>

Let me know what happens?

Apr 28 '06 #3

nv*********@caitele.com wrote:
OK, From what i can tell from your script is that you want a basic form
to enter in new customer equiptment into a database. I can see that you
want to enter in new data everytime you access this page, you are not
looking to update a customer record but enter in a new record.


You must have been looking at something else entirely. The OP's form
clearly displays current data in text boxes for updating. He wants to
be able to change existing values and pass these to the next page which
processes an update. There is no suggestion that he is looking to add
new records with these pages.

If he wants to be able to update one record at a time, his second page
should populate a form with the record associated with the ID number
passed in the querystring, and there is no need for text boxes or a
form on the first page. He can just write the recordset as a list or
in a table on the first page.

First Page:

<%

Do While Not objRecordset.EOF

Response.Write "<tr>"
Response.Write "<td align=center valign=top>" &
objRecordset("ContactName") & "</td>"
Response.Write "<td valign=top align=center>" &
objRecordset("Radio") &
"</td>"
Response.Write "<td valign=top align=center>" &
objRecordset("Mobile") &
"</td>"
Response.Write "<td valign=top align=center><a
href=supers_nxtlUpdate.asp?ID="
Response.Write objRecordset("Id") & ">Update</a></td>"

Response.Write "</tr><tr><td colspan=6><hr></td></tr><tr>"
& vbcrlf

objRecordset.MoveNext
Loop

objRecordset.Close : set ObjRecordset = Nothing

%>

In the second page, it's not a good idea to use a recordset to perform
an update, and dynamic sql should be avoided. He would be better
advised to use parameters and the command object, or better yet, a
saved parameter query.

Open Access, and go top the Query Tab. Click New Query in Design View,
and close the Show Tables dialogue box that appears. Switch to SQL
view and paste this in:

UPDATE tblContactList SET strContactName = [p1], strRadio = [p2],
strMobile = [p3] WHERE ID = [p4];

Save that as qUpdateContact, and then run the query. You are prompted
for values for p1, p2 etc. Enter something sensible to make sure the
query runs. Close Access, and in the second page do this:

<%
If Request.Form("Action") ="Submit" then

p1 = Request.Form("ContactName")
p2 = Request.Form("Radio")
p3 = Request.Form("Mobile")
p4 = Request.Form("ID")

'validate values for p1 - p4

strConnect = "Driver={Microsoft Access Driver (*.mdb)};
DBQ=\\CALSJ1\PMAPPS\nextel.mdb"

'or better still use the OLEDB provider:
'strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=\\CALSJ1\PMAPPS\nextel.mdb"

set conn = Server.CreateObject("ADODB.Connection")
conn.Open strConnect
conn.qUpdateContact p1,p2,p3,p4
conn.Close : set conn = Nothing

Response.Write "Record Updated"
Else
....

'Write the form to the page, populating it with the record associated
with the ID passed in the QueryString

End If
%>

Saved parameter queries are so much easier to work with if you are
using Access. The query is constructed, tested and debugged within the
database, they help prevent SQL Injection attacks, and they are easier
to maintain. If a field name needs to be changed, for example, you
only need to do it in the database table and queries, rather than
working through all your scripts to do so. Oh, and you get rid of all
the problems associated with data type mismatches, and incorrectly
delimiting datatypes in concatenated dynamic SQL statements. No
Recordset object needs to be created, and the connection object is
created, opened, used, closed and destroyed in the space of 4 lines.

--
Mike Brind

Apr 28 '06 #4
Matt wrote:
I have the following in a page and I am trying to update a
record on the next page but for some reason the form data is
not carrying over. Any ideas why?

<form name=nxtlupdate method=post action=supers_NxtlUpdate.asp> ^^^^^^^^^^^ strID = Request.QueryString("ID")

^^^^^^^^^^^^^^^^^

When you POST, look in the Request.Form collection for the name-value pairs.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Apr 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
4
by: Ivan Shevanski | last post by:
Alright heres my problem. . .Say I want to carry over a variable from one function to another or even another run of the same function. Is that possible? Heres a quick example of what I'm talking...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
5
by: amanatio | last post by:
I have a huge form with many data bound controls on it and 34 tables in database (and of course 34 data adapters and 34 datasets). The form is extremely slow to design (huge delay when I go to code...
23
by: Dave G | last post by:
Since upgrading one of my clients from A97/W2000 to A2003/XP they have suffered no end of data corruption problems, mainly involving one of the main tables. The corruption can result in one...
4
by: Kurrent | last post by:
I have some data from text fields that are being passed over through a form that I am displaying with the $_POST superglobal. Once i have echo'd out this data onto the next page, i'd like to...
5
by: Boki | last post by:
Hi All, There are two forms, when some click happen, it fires to set form2's viable as enable. The form2 is for user to input some text and then the data need to be collected into form1's...
7
by: cartercc | last post by:
I think I already know the answer to this one, but I'm giving it the old college try. My problem is this: I have an HTML form that sends a bunch of data to a Perl script, where it is validated...
3
by: franc sutherland | last post by:
Hello, I have a report which I filter using the me.filter command in the OnOpen event. Me.Filter = "OrderID=" & Forms!variable_form_name! Me.FilterOn = True I want to be able to open that...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.