select command


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: select command

  1. #1
    cal Guest

    select command


    Hi
    I am trying to use the input from any of three text boxes
    (last name, first name or ID) to
    select and match records from a access2k database-----I am not sucessful.
    Any help?

    here is the code for the search

    regards
    cal


    SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
    frmSearch.txtLastName.Text & "' "

    SQL = "SELECT * FROM Contact WHERE [First / Middle Initial] LIKE '" & _
    frmSearch.txtFirstName.Text & "'"

    SQL = "SELECT * FROM Contact WHERE [ID Number] LIKE '" & _
    frmSearch.txtID.Text & "';"

  2. #2
    T H Guest

    Re: select command


    In Access LIKE statement uses *

    SELECT * FROM TABLE_NAME WHERE NAME LIKE '*SOME_NAME*'

    T H

    "cal" <sticks2@earthlink.net> wrote:
    >
    > Hi
    > I am trying to use the input from any of three text boxes
    >(last name, first name or ID) to
    > select and match records from a access2k database-----I am not sucessful.
    >Any help?
    >
    >here is the code for the search
    >
    >regards
    >cal
    >
    >
    >SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
    > frmSearch.txtLastName.Text & "' "
    >
    >SQL = "SELECT * FROM Contact WHERE [First / Middle Initial] LIKE '" & _
    > frmSearch.txtFirstName.Text & "'"
    >
    >SQL = "SELECT * FROM Contact WHERE [ID Number] LIKE '" & _
    > frmSearch.txtID.Text & "';"



  3. #3
    cal Guest

    Re: select command


    I used the like statement---see the code below=--==-==I was thinking about
    a case statement
    and then select the correct case----has anyone done that






    "T H" <tonnyh@medianetworks.net> wrote:
    >
    >In Access LIKE statement uses *
    >
    >SELECT * FROM TABLE_NAME WHERE NAME LIKE '*SOME_NAME*'
    >
    >T H
    >
    >"cal" <sticks2@earthlink.net> wrote:
    >>
    >> Hi
    >> I am trying to use the input from any of three text boxes
    >>(last name, first name or ID) to
    >> select and match records from a access2k database-----I am not

    sucessful.
    >>Any help?
    >>
    >>here is the code for the search
    >>
    >>regards
    >>cal
    >>
    >>
    >>SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
    >> frmSearch.txtLastName.Text & "' "
    >>
    >>SQL = "SELECT * FROM Contact WHERE [First / Middle Initial] LIKE '" & _
    >> frmSearch.txtFirstName.Text & "'"
    >>
    >>SQL = "SELECT * FROM Contact WHERE [ID Number] LIKE '" & _
    >> frmSearch.txtID.Text & "';"

    >



  4. #4
    K Guest

    Re: select command


    Hi Cal,

    Do you get an error or dont you get any results? If you have a form where
    any of the 3 fields could be filled in and you use "LIKE", because you want
    to get all contacts beginning with the input, you could try this, (I assume
    ID Number is an integer):

    SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
    frmSearch.txtLastName.Text & "%' OR [First / Middle Initial] LIKE
    '" & _
    frmSearch.txtFirstName.Text & "%' OR [ID Number] = " & _
    CInt(frmSearch.txtID.Text)

    regards,
    Kristina



    "cal" <sticks2@earthlink.net> wrote:
    >
    > Hi
    > I am trying to use the input from any of three text boxes
    >(last name, first name or ID) to
    > select and match records from a access2k database-----I am not sucessful.
    >Any help?
    >
    >here is the code for the search
    >
    >regards
    >cal
    >
    >
    >SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
    > frmSearch.txtLastName.Text & "' "
    >
    >SQL = "SELECT * FROM Contact WHERE [First / Middle Initial] LIKE '" & _
    > frmSearch.txtFirstName.Text & "'"
    >
    >SQL = "SELECT * FROM Contact WHERE [ID Number] LIKE '" & _
    > frmSearch.txtID.Text & "';"



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center