Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confused displaying'no records found' message

Status
Not open for further replies.

sickpuppy

Technical User
Feb 22, 2001
40
GB
Hi

I am developing a searchable database of news items, at the moment using MS Access. I have created a search function to extract news articles based on key words (property, mortgages etc)but I am confusing myself as to how to display a message when the search terms do not match any records in my articles fields. Should i be trying to do this with ASP or with a javascript?

Cheers

 
use ASP. check for recordset.EOF and recordset.BOF, after you execute the query. if it's true, you have no records found, and just display some simple string saying "no records were found. please try again".

ex:

if rs.eof and rs.bof then
response.write "i found nothing in the search"
else
'do your display code here
end if

hth
leo

------------
Leo Mendoza
lmendoza@students.depaul.edu
 
Hi,

I tend to check the RecordCount of the returned recordset and if so, display a message and stop processing. Where RS is your recordset, an example would be:

if RS.RecordCount = 0 then
RS.Close
response.write "No records were returned"
response.write &quot;</body></html>&quot;
response.end
end if
 
biomed -
recordcount only works if you have a cursor that supports forward and backward movements. If you use the default firehose cursor, .recordcount will return -1 at times. I try to use the default cursor as much as possible, since is the fastest one.
hth
leo

------------
Leo Mendoza
lmendoza@students.depaul.edu
 
thanks guys, just what I needed to sort my head out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top