True/False on SQL Search

Results 1 to 2 of 2

Thread: True/False on SQL Search

  1. #1
    Cactushead Guest

    Default True/False on SQL Search

    I&#039m trying to search my access database file for a specific code which a user passes via a querystring. <BR><BR>I can find all matching results but I would like to just know if the item exists or not so i can create a contitional statement to do one of two things depending on the true/false result from the SQL statement.<BR><BR>The code is like this :-<BR><BR>OFFERSSQL="SELECT OffersCode, OffersPrice FROM Offers WHERE Offers.OffersCode = &#039" & Code & "&#039 ORDER BY OffersCode"<BR><BR>I&#039ve also tryed WHERE EXISTS but I don&#039t know how to create the if/else statement.<BR><BR>I would apreciate any help on this problem as I can&#039t get it to work.

  2. #2
    Join Date
    Dec 1969

    Default RE: True/False on SQL Search

    You could just do your regular query and get the recordset back, and then just test:<BR><BR>if NOT(rs.EOF) then<BR> &#039Item exists<BR>end if<BR><BR>That will just let you determine whether someone was found or not, and you don&#039t have to cycle through the recordset values. Depending on how you open your recordset, you could use rs.recordcount too.....or, just do a select count(*).....<BR><BR>Not sure about a quick and easy SQL / non-rs way though....<BR><BR>James

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts