473,387 Members | 1,476 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,387 software developers and data experts.

ASP UPDate database looping through form fields

Hi,

I have a small online survey in two parts designed to allow users to
rank a few organisations that they have dealings with from a large
list of organisations. I want the users to be able to rank a number
of organisations at the same time rather than going through a form for
each one.

At the moment the survey has two pages. The first page allows the user
to select a number of organisations from the list. This selection is
saved in a table in an Access database with five fields: ID, User,
Organisation and Ranking.

The second page loops through the data from the database selected by
user and presents the list of organisations in a table with a row for
each record. The table has a ranking field for each organisation. The
user enters numeric data in this field to rank the organisation.

So far so good. Where I am having problems is in updating the database
with the data from the form. What I need to do is loop through each
line of the table on the form, select the record from the database,
update it and then move to the next item.

The form has a field for each record with the same name so using
Request.Form("FieldName") to grab the data from the form doesn't seem
to work.

I am sure that there must be a way of achieving what I want do: but I
can't get it.

I'd appreciate any suggestions or pointers.

Thanks in advance for any help.

Regards
Emmett Power
Jul 19 '05 #1
4 5923
How about;

<%
strString1 = Request.form("Ima_Field")

Do Until rst.eof
rst("TheField")=strString1
rst.MoveNext
Loop
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Emmett Power" <Em****@Silico-Research.com> wrote in message
news:6e**************************@posting.google.c om...
Hi,

I have a small online survey in two parts designed to allow users to
rank a few organisations that they have dealings with from a large
list of organisations. I want the users to be able to rank a number
of organisations at the same time rather than going through a form for
each one.

At the moment the survey has two pages. The first page allows the user
to select a number of organisations from the list. This selection is
saved in a table in an Access database with five fields: ID, User,
Organisation and Ranking.

The second page loops through the data from the database selected by
user and presents the list of organisations in a table with a row for
each record. The table has a ranking field for each organisation. The
user enters numeric data in this field to rank the organisation.

So far so good. Where I am having problems is in updating the database
with the data from the form. What I need to do is loop through each
line of the table on the form, select the record from the database,
update it and then move to the next item.

The form has a field for each record with the same name so using
Request.Form("FieldName") to grab the data from the form doesn't seem
to work.

I am sure that there must be a way of achieving what I want do: but I
can't get it.

I'd appreciate any suggestions or pointers.

Thanks in advance for any help.

Regards
Emmett Power

Jul 19 '05 #2
Hello Emmett
Try this!

<HTML>
<HEAD>
</HEAD>
<BODY><%
Dim Item
response.write "<TABLE cellSpacing=0 cellPadding=0 width=715 border=0>"
response.write "<Th align=center vAlign=top WIDTH=33% colSpan=3>Key</TD> "
response.write "<Th align=right vAlign=top WIDTH=33% colSpan=3>Item</TD> "
response.write "<Th align=right vAlign=top WIDTH=33% colSpan=3>Count</TD>
"
Response.Write "<tr><TD>"

For Each Item in Request.Form

response.write "<TD align=left vAlign=top WIDTH=33% colSpan=3> "
Response.Write Request.Form.Key(Item) & ": " & "</td><TD>"
response.write "<TD align=left vAlign=top WIDTH=33% colSpan=3> "
Response.Write Request.Form.Item(Item) & " " & "</td><TD>"
response.write "<TD align=left vAlign=top WIDTH=33% colSpan=3> "
Response.Write Request.Form.Item(Item).Count & "</td></tr><tr><TD>"
Next
Response.Write "</TABLE> "
%>
</BODY>

</HTML>

"Emmett Power" <Em****@Silico-Research.com> wrote in message
news:6e**************************@posting.google.c om...
Hi,

I have a small online survey in two parts designed to allow users to
rank a few organisations that they have dealings with from a large
list of organisations. I want the users to be able to rank a number
of organisations at the same time rather than going through a form for
each one.

At the moment the survey has two pages. The first page allows the user
to select a number of organisations from the list. This selection is
saved in a table in an Access database with five fields: ID, User,
Organisation and Ranking.

The second page loops through the data from the database selected by
user and presents the list of organisations in a table with a row for
each record. The table has a ranking field for each organisation. The
user enters numeric data in this field to rank the organisation.

So far so good. Where I am having problems is in updating the database
with the data from the form. What I need to do is loop through each
line of the table on the form, select the record from the database,
update it and then move to the next item.

The form has a field for each record with the same name so using
Request.Form("FieldName") to grab the data from the form doesn't seem
to work.

I am sure that there must be a way of achieving what I want do: but I
can't get it.

I'd appreciate any suggestions or pointers.

Thanks in advance for any help.

Regards
Emmett Power
Jul 19 '05 #3
Personally, i think the best solution is:
after the user selects that they want eg. 5 items
for each item you print out, give it an incremental suffix e.g "_" & i

like so:
maxItems = Request.Form("num")

for i = 1 to maxItems
response.write "<blah blah blah field name='fld_" & i & "'>"

you know the rest..
next

on ur post you send ur maxitems value
and on ur transaction page you simply loop through the items that were sent
eg.

for i = 1 to maxItems
strSentField = Request.form("fld_"&i)
next

ya know?
"Emmett Power" <Em****@Silico-Research.com> wrote in message
news:6e**************************@posting.google.c om...
Hi,

I have a small online survey in two parts designed to allow users to
rank a few organisations that they have dealings with from a large
list of organisations. I want the users to be able to rank a number
of organisations at the same time rather than going through a form for
each one.

At the moment the survey has two pages. The first page allows the user
to select a number of organisations from the list. This selection is
saved in a table in an Access database with five fields: ID, User,
Organisation and Ranking.

The second page loops through the data from the database selected by
user and presents the list of organisations in a table with a row for
each record. The table has a ranking field for each organisation. The
user enters numeric data in this field to rank the organisation.

So far so good. Where I am having problems is in updating the database
with the data from the form. What I need to do is loop through each
line of the table on the form, select the record from the database,
update it and then move to the next item.

The form has a field for each record with the same name so using
Request.Form("FieldName") to grab the data from the form doesn't seem
to work.

I am sure that there must be a way of achieving what I want do: but I
can't get it.

I'd appreciate any suggestions or pointers.

Thanks in advance for any help.

Regards
Emmett Power

Jul 19 '05 #4

Guys,

Thanks for the suggestions. I'm going to try them out this weekend.

Regards

Emmett
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5

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

Similar topics

1
by: Roy Adams | last post by:
Hello people I've recently been woring with multiple insert from text fields and got that woking fine thanks to the help from people from this forum now i'm trying to deal with multiple update,...
4
by: Roy Adams | last post by:
Hi posting again because no answer to previous.. tring to loop through a recordset and update a record, thing is it only updates the first record in the table rather than searching through the...
0
by: Chris Hall | last post by:
The records in my database are displayed in a form as follows: %> <form action="report-ammend1.42.asp" method="post"name="form"> <table border=1> <% x = 1
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
2
by: devine | last post by:
Hi All, I am trying to send an automatic email when an update has been made. My update statement will updates 6 fields, and dependant on one of the fields, I would like to send an email using CDO....
2
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
3
by: Slower Than You | last post by:
I am trying to write an SQL UPDATE statement for an MSAccess table and am having some problems getting my head around it. Can anyone help? TableName: CustTransactions TransactionKey AutoNumber ...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.