Adding an action when no records are found during a database searc

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am searching an Access database for certain criterion. I want to know how
I can set an action (like opening another page) if no records are found
matching the input criteria.
 
How are you doing this....with ASP? With the Results wizard?...the DBRW
only offers the option of putting a "No records found" message on the same
page as the dbrw is based

You would have to custom-code whatever solution you wanted or find another
solution elsewhere (try www.hotscripts.com)
 
An example, in ASP, would look something like this

<%

Dim DSN_Name, Conn
DSN_Name = <insert your DSN or connection string>
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open DSN_Name

Dim objRS, strSQL

'Create the recordset object
Set objRS = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT * FROM Table WHERE FieldName = x "
objRS.Open strSQL, DSN_Name

if objRS.EOF then
Response.Redirect("nextpage.asp")
else

... whatever they do if there is a match

end if

%>
 
Back
Top