Results 1 to 6 of 6

Thread: [RESOLVED] trouble with LIKE operator

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2009
    Location
    B.C. Canada
    Posts
    206

    Resolved [RESOLVED] trouble with LIKE operator

    i am new to the LIKE operator. i am setting up a search in an access database so the user can search a partial string, eg search for "White" and find all records with the word white as part of the field contents.
    this works when i make a query inside access but i cannot duplicate it in VB6 when connected to the same database table. i get an empty recordset
    what am i doing wrong?
    Code:
       
    Private Sub Form_Load()
    Set CNSKUList = New ADODB.Connection
    CNSKUList.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & WorkFlowDatabasePath & ";" & "user id=admin;password=;"
    CNSKUList.Open
    Set RstSKUList = New ADODB.Recordset
    end sub
    
    Private Sub SearchButton_Click()
     RstSKUList.Open "select * from SKULIST WHERE Description LIKE ' * White * '  ", CNbatchtable, adOpenKeyset, adLockOptimistic, adCmdTableDirect
                   Set SKUListMSHFlexGrid.DataSource = RstSKUList
       RstSKUList.Close
    end sub
    Last edited by daveinarmstrong; Oct 25th, 2011 at 12:47 PM.

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