Advertisement

09.25.2008 at 01:20PM PDT, ID: 23764111
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Clear Results Button SQL

Asked by vzdog in SQL Query Syntax, Microsoft Access Database, Scripting Languages

Tags:

I have a Search page built on my site to search an access table.
The search works fine, but I need to provide a method for the users to Clear the results via a button, and allow a new search.

This is probably a very easy task but I have not been able to figure it out.
As you can see in my code I tried to use "YourRecordset.close"
and that just gives me an error.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
<form action ="<%= request.servervariables("script_name") %>" method="post">
<input type="text" name="u_input" value="<%= u_input %>">
<select name="u_field" size="1">
<option <% ' write out all the search fields and select
if u_field = "CktID" or u_field = "" then
response.write "selected "
end if
%>value="CktID">CktID</option>
</select>
<input type="submit" value="Submit">
</form> 
 
<p>&nbsp;</p>
<p>&nbsp;</p>
 
<form>
<input type="button" value="Clear Results" onClick="YourRecordset.close()">
</form> 
 
<%
u_input = trim(request.form("u_input")) 'u_input is the varible for user input 
' the trim function removes any blanks around the the use input
u_field=request.form("u_field") 'the dropdown varible for user inputted search field
 
if u_input <> "" then ' If the user entered a value query the db
accessdb="East_pmi" ' name of the access db 
table_name="tblPMEastBaseRaw" ' name of the table within the access db
cn="driver={microsoft access driver (*.mdb)};"
cn=cn & "dbq=" & server.mappath(accessdb)
set rs = server.createobject("ADODB.Recordset")
sql = "select * from "& table_name &" where " & u_field & " like '%%" & u_input & "%%' " 
rs.Open sql, cn
 
if rs.eof or rs.bof then 
response.write "No results found..." 
observations=0
else
observations=1
end if 'end check for observations
end if 'end check for user input
%>
<% 'If there are observations then display them 
if observations > 0 then %>
 
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table border="2" bordercolor="black">
<tr>
<% 'Write the field names
for each table_element in rs.fields %>
<td width="100" border="2"><b><%= table_element.name%></B></TD><%
next %>
</tr>
<tr>
<% 'Write the values
rs.movefirst
do while not rs.eof
for each cell in rs.fields %>
<td><%= cell.value %></td><% 
next %>
</tr>
<% rs.movenext
loop %>
</table>
<% end if 'end of check of obs for display %>
 
 
 
</body>
</html>
[+][-]09.26.2008 at 05:14AM PDT, ID: 22578595

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.26.2008 at 06:42AM PDT, ID: 22579363

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.26.2008 at 04:10PM PDT, ID: 22584654

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.28.2008 at 07:02AM PDT, ID: 22591028

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Query Syntax, Microsoft Access Database, Scripting Languages
Tags: SQL
Sign Up Now!
Solution Provided By: MikeToole
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628