Results 1 to 2 of 2

Thread: Searching a GDBGrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    1

    Searching a GDBGrid

    Hello all,

    Basically, I have a GBGrid which is linked to Access. It displays all the names of people entered into the database. I want to be able to search the database to find a name. So far my code only allows me to find a record/name when I search the EXACT name in the search bar. E.g. If I search "Jack Venn" I will get one result for that record. However, if I search "Jack" I get no results. Is there any way to be able to enter a keyword or part of a name and get results?

    Private Sub cmd_search_Click()
    Set rs_customer = db.OpenRecordset("select * from Customer where Customer.Customer_Name like'" & txt_customersearch.Text & "'")
    Set Data1.Recordset = rs_customer
    End Sub

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Searching a GDBGrid

    The pattern supplied to LIKE needs to be a pattern rather than a complete value.

    So search for "Jack*" when using DAO.

Posting Permissions

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



Click Here to Expand Forum to Full Width