Default Search for 2 field values return all results?

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Default Search for 2 field values return all results?

    Hi. I have two fields that users can search for. Either room number or
    Phone number. They can also put both a room number and a phone number and
    search using both fields. However, this produces the default behavior of
    returning all results if nothing is entered into either field. Here's what
    the statement looks like.

    fp_sQry="SELECT * FROM Results WHERE (Phone = ::Phone:: AND Room =
    ::Room::)"
    fp_sDefault="Phone=[Phone]&Room=[Room]"
    fp_sDataConn="fixittickets"
    fp_iMaxRecords=256
    fp_iCommandType=1
    fp_iPageSize=5
    fp_fTableFormat=True
    fp_fMenuFormat=False
    fp_sMenuChoice="Name"
    fp_sMenuValue="Name"
    fp_iDisplayCols=5
    fp_fCustomQuery=False
    BOTID=0
    fp_iRegion=BOTID

    (note first statement may wrap).

    How can this be revised so that the default is to return No Reults until a
    value for either phone or room (or both) are entered?

    TIA!


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.552 / Virus Database: 344 - Release Date: 12/15/2003


    Dave Guest

  2. Similar Questions and Discussions

    1. Date/Time field default values!
      I'm creating a CF page that keeps track of dates/time of things. I have all my Date/Time fields set-up as Date/Time in access and I use...
    2. Sending search results to a results page..with asp
      Please help.. very :confused; Ive setup 4 dynamic drop down boxes which populate themselves from my database, this all works fine..The last box...
    3. need to return results from dynamic quizes
      Within the CDRom I'm creating each section is followed by a dynamic quiz. I would like to include a page at the end of the CD that the user can...
    4. DB2 Select - how to return a range of results
      Hi, Here is some SQL from MS SQL 2000: select top 5 * from (select top 5 * from (select top 25 code, name, address from contacts where name...
    5. Return Search Results on the Same Page
      I am new to ASP and would like to write a page with a drop down listbox on the top of the page. As soon as user choose a value in the dropdown,...
  3. #2

    Default Re: Default Search for 2 field values return all results?

    first you need to do a return false on the onsubmit event of the form if
    both fields are blank...

    onsubmit="if(formname.phonefield.value=='' && formname.roomfield.value=='')
    {alert('Please fill in at least a field before submitting');return false;}
    else return true;"

    then you might want to modify the query depending on the parameters (phone
    only, room only or both)

    qry = "SELECT * FROM RESULTS WHERE "

    if request.form("phonefield")<>"" then qry = qry & " PHONE=" &
    request.form("phonefield")
    if request.form("roomfield") <>"" then
    if request.form("phonefield")<> "" then qry = qry & " AND "
    qry = qry & " ROOM=" & request.form("roomfield")
    end if



    "Dave" <spam@that> wrote in message
    news:%23jsVk1$wDHA.2568@TK2MSFTNGP09.phx.gbl...
    > Hi. I have two fields that users can search for. Either room number or
    > Phone number. They can also put both a room number and a phone number and
    > search using both fields. However, this produces the default behavior of
    > returning all results if nothing is entered into either field. Here's
    what
    > the statement looks like.
    >
    > fp_sQry="SELECT * FROM Results WHERE (Phone = ::Phone:: AND Room =
    > ::Room::)"
    > fp_sDefault="Phone=[Phone]&Room=[Room]"
    > fp_sDataConn="fixittickets"
    > fp_iMaxRecords=256
    > fp_iCommandType=1
    > fp_iPageSize=5
    > fp_fTableFormat=True
    > fp_fMenuFormat=False
    > fp_sMenuChoice="Name"
    > fp_sMenuValue="Name"
    > fp_iDisplayCols=5
    > fp_fCustomQuery=False
    > BOTID=0
    > fp_iRegion=BOTID
    >
    > (note first statement may wrap).
    >
    > How can this be revised so that the default is to return No Reults until a
    > value for either phone or room (or both) are entered?
    >
    > TIA!
    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    > Version: 6.0.552 / Virus Database: 344 - Release Date: 12/15/2003
    >
    >

    Luis Guest

Posting Permissions

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

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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139