There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Web Design & Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox format freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop malware motherboard mouse network networking outlook 2007 power printer problem ram router screen slow sound spyware trojan usb virus vista vista 32-bit windows windowsxp windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
If/Then Statement to show "No Records Found"


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Dudaright's Avatar
Junior Member with 8 posts.
 
Join Date: Aug 2004
Experience: Intermediate
10-Aug-2004, 11:37 AM #1
Cool If/Then Statement to show "No Records Found"
When using access and ASP, I need to have a statement that shows that no records were found when a selection is made that does not correspond with data from the database. How do I do this? In the EOF statement?
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
10-Aug-2004, 05:02 PM #2
Yes,
IF recodset.EOF THEN dosomething
ELSE
dosomethingelse
END IF
Dudaright's Avatar
Junior Member with 8 posts.
 
Join Date: Aug 2004
Experience: Intermediate
12-Aug-2004, 08:52 PM #3
Cool ROCN...It finally worked
It didn't like the Else statement, but I change the script around a little to get it to work. This is what it looks like:

<%

Set oConn= server.createObject("adodb.connection")
strConn="Driver={Microsoft Access Driver (*.mdb)};Dbq=" & server.mappath("/fpdb/cadata.mdb") & ";"
oconn.open(strConn)
strSelect1 = Request.Form("Select1")
strSelect2 = Request.Form("Select2")
strSelect3 = Request.Form("Select3")
strSelect4 = Request.Form("Select4")
set oRS=oconn.execute("Select * FROM Listings WHERE make= '"& strSelect1 &"' AND model= '"& strSelect2 &"' AND year<= '"& strSelect3 &"' AND year>= '"& strSelect4 &"'")
%>
<%
If oRS.EOF Then Response.Redirect "nomatch.asp"
If Not oRS.EOF Then oRS.MoveFirst
%>
<%
Do while Not oRS.EOF
%>
<tr><b>
<td bgcolor="#F5D799"><p align="center"> <font size="2" face="Arial">
<%
IF oRS.Fields("photoavailable") = "True" Then
%>
<img src="images/camera.gif">
<%
If oRS.Fields("photoavailable") = "False" Then Response.Write(".")
End If
%>
</p></font></td>
<td bgcolor="#F5D799"><p align="center"> <font size="2" face="Arial"> <%= oRS("year") %></font></td>
<td bgcolor="#F5D799"><p align="center"> <font size="2" face="Arial"> <%= oRS("make") %>&nbsp;<%= oRS("model") %></font></td>
<td bgcolor="#F5D799"><p align="center"> <font size="2" face="Arial"> <%= oRS("mileage") %></font></td>
<td bgcolor="#F5D799"><p align="center"> <font size="2" face="Arial"> <%= oRS("price") %></font></td>
<td bgcolor="#F5D799"><p align="center"> <font size="2" face="Arial"> <%= oRS("color") %></font></td>
<td bgcolor="#F5D799"><p align="center"> <font size="2" face="Arial"> <%= oRS("dealer") %></font></td>
<%
oRS.MoveNext
Loop

%>

</tr></b>
</table>
</center>
</div>

<%
oRS.close
set oRS=nothing
oConn.close
set oConn=nothing
%>
...This is kind of messy, but it worked. Thanks again for the help.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:07 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.