Connecting Tech Pros Worldwide Forums | Help | Site Map

Looping question

David
Guest
 
Posts: n/a
#1: Jun 13 '07
Hi,

I have an asp page which lists records out in rows
Each record has a checkbox with a value parameter equal to the
RecordID

When the form is run, it goes to a page which I am trying to create 1
report printed after the other.
i.e. if the user selects 3 records on the form, the report is printed
on the next asp page for record 1 and then straight after it runs the
same data and prints the report for record 2.

In the report page I have the following code:

For i = 1 to Request.Form.Count
fieldName = Request.Form.Key(i)
fieldValue = Request.Form.Item(i)

if Request.Form.key(i) <"Submit" then

**** "SELECT * blah blah blah and response.write all my asp data for
report ****

end if
Next

The above code prints the report for record 1, but that is all.
What would I need to do to make it print all the selected records

On the initial form I have the following code for each checkbox
against each record:
<input type=checkbox name=printme value=" & RS("ReportID") & ">

I hope there is a solution out there

Many thanks in advance

David


Jon Paal [MSMD]
Guest
 
Posts: n/a
#2: Jun 13 '07

re: Looping question


The problem appears to be in this block:

" **** "SELECT * blah blah blah and response.write all my asp data for
report **** "


You will need to correctly configure the Select statement to build it up from the user chosen form elements

google :

asp -.net dynamnic sql

and then loop through the records to display them.

google:

asp -.net looping through records








"David" <davidgordon@scene-double.co.ukwrote in message news:1181745388.553961.92170@g37g2000prf.googlegro ups.com...
Quote:
Hi,
>
I have an asp page which lists records out in rows
Each record has a checkbox with a value parameter equal to the
RecordID
>
When the form is run, it goes to a page which I am trying to create 1
report printed after the other.
i.e. if the user selects 3 records on the form, the report is printed
on the next asp page for record 1 and then straight after it runs the
same data and prints the report for record 2.
>
In the report page I have the following code:
>
For i = 1 to Request.Form.Count
fieldName = Request.Form.Key(i)
fieldValue = Request.Form.Item(i)
>
if Request.Form.key(i) <"Submit" then
>
**** "SELECT * blah blah blah and response.write all my asp data for
report ****
>
end if
Next
>
The above code prints the report for record 1, but that is all.
What would I need to do to make it print all the selected records
>
On the initial form I have the following code for each checkbox
against each record:
<input type=checkbox name=printme value=" & RS("ReportID") & ">
>
I hope there is a solution out there
>
Many thanks in advance
>
David
>

David
Guest
 
Posts: n/a
#3: Jun 14 '07

re: Looping question


Hello Jon,

My SQL is as follows:-

strquery = ""
strquery = "SELECT * FROM reports"
strquery = strquery & " WHERE ((reports.ReportID='" & fieldValue &
"'));"

--------------------------------------------------------------------------------------------------------------------------------------------
On 13 Jun, 17:54, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
Quote:
The problem appears to be in this block:
>
" **** "SELECT * blah blah blah and response.write all my asp data for
report **** "
>
You will need to correctly configure the Select statement to build it up from the user chosen form elements
>
google :
>
asp -.net dynamnic sql
>
and then loop through the records to display them.
>
google:
>
asp -.net looping through records
>
"David" <davidgor...@scene-double.co.ukwrote in messagenews:1181745388.553961.92170@g37g2000prf.go oglegroups.com...
Quote:
Hi,
>
Quote:
I have an asp page which lists records out in rows
Each record has a checkbox with a value parameter equal to the
RecordID
>
Quote:
When the form is run, it goes to a page which I am trying to create 1
report printed after the other.
i.e. if the user selects 3 records on the form, the report is printed
on the next asp page for record 1 and then straight after it runs the
same data and prints the report for record 2.
>
Quote:
In the report page I have the following code:
>
Quote:
For i = 1 to Request.Form.Count
fieldName = Request.Form.Key(i)
fieldValue = Request.Form.Item(i)
>
Quote:
if Request.Form.key(i) <"Submit" then
>
Quote:
**** "SELECT * blah blah blah and response.write all my asp data for
report ****
>
Quote:
end if
Next
>
Quote:
The above code prints the report for record 1, but that is all.
What would I need to do to make it print all the selected records
>
Quote:
On the initial form I have the following code for each checkbox
against each record:
<input type=checkbox name=printme value=" & RS("ReportID") & ">
>
Quote:
I hope there is a solution out there
>
Quote:
Many thanks in advance
>
Quote:
David




Jon Paal [MSMD]
Guest
 
Posts: n/a
#4: Jun 14 '07

re: Looping question


That will return 1 record because you have specified exactly 1 record id.



"David" <davidgordon@scene-double.co.ukwrote in message news:1181812562.367926.295420@j4g2000prf.googlegro ups.com...
Quote:
Hello Jon,
>
My SQL is as follows:-
>
strquery = ""
strquery = "SELECT * FROM reports"
strquery = strquery & " WHERE ((reports.ReportID='" & fieldValue &
"'));"
>
--------------------------------------------------------------------------------------------------------------------------------------------
On 13 Jun, 17:54, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
Quote:
>The problem appears to be in this block:
>>
>" **** "SELECT * blah blah blah and response.write all my asp data for
>report **** "
>>
>You will need to correctly configure the Select statement to build it up from the user chosen form elements
>>
>google :
>>
>asp -.net dynamnic sql
>>
>and then loop through the records to display them.
>>
>google:
>>
>asp -.net looping through records
>>
>"David" <davidgor...@scene-double.co.ukwrote in messagenews:1181745388.553961.92170@g37g2000prf.go oglegroups.com...
Quote:
Hi,
>>
Quote:
I have an asp page which lists records out in rows
Each record has a checkbox with a value parameter equal to the
RecordID
>>
Quote:
When the form is run, it goes to a page which I am trying to create 1
report printed after the other.
i.e. if the user selects 3 records on the form, the report is printed
on the next asp page for record 1 and then straight after it runs the
same data and prints the report for record 2.
>>
Quote:
In the report page I have the following code:
>>
Quote:
For i = 1 to Request.Form.Count
fieldName = Request.Form.Key(i)
fieldValue = Request.Form.Item(i)
>>
Quote:
if Request.Form.key(i) <"Submit" then
>>
Quote:
**** "SELECT * blah blah blah and response.write all my asp data for
report ****
>>
Quote:
end if
Next
>>
Quote:
The above code prints the report for record 1, but that is all.
What would I need to do to make it print all the selected records
>>
Quote:
On the initial form I have the following code for each checkbox
against each record:
<input type=checkbox name=printme value=" & RS("ReportID") & ">
>>
Quote:
I hope there is a solution out there
>>
Quote:
Many thanks in advance
>>
Quote:
David
>
>
>
>
>

Closed Thread


Similar ASP / Active Server Pages bytes