Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    3

    Exclamation Unanswered: Using wildcards to search number field

    I have a database. I want to have a form where the user puts in an area code and it uses that value to search the PHONE field. How do I use the wildcard of * with the value from the from?
    This is the code I have tried so far..
    <form name="form" method="post" action="">
    <p>

    Record#:
    <input type="text" name="ID">

    <input type="submit" name="Submit" value="Delete Record">
    </p>
    </form>
    <%
    Dim Conn, RS, PMID
    PMID = Request.Form("ID")
    Set Conn = Server.CreateObject("ADODB.Connection")
    Set RS = Server.CreateObject("ADODB.RecordSet")
    Conn.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("zip.mdb"))

    sql = "Select * from Dealer WHERE Phone Like" & PMID'*"
    Conn.execute(sql)
    Conn.Close



    %>
    </body>

  2. #2
    Join Date
    Dec 2004
    Location
    York, PA
    Posts
    95
    You just missed a bit
    sql = "Select * from Dealer WHERE Phone Like '" & PMID & "*'"

  3. #3
    Join Date
    Dec 2004
    Location
    York, PA
    Posts
    95
    Ohhh and I think Jet means you have to use % instead of *

Posting Permissions

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