Results 1 to 2 of 2

Thread: LIKE operator fails for ADODB open statement

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000


    I cannot work out why the open statement for the SQL statement below returns 0 matches. Can anyone suggest work arounds/possibly explanations why this will not work.

    I have executed the SQL from Access and it returns the the records I expect. Could the syntax for ADODB we different to that of Access?

    Many thanks.

    Private Sub performSearch2()

    Dim strSELECTStatement As String
    Dim strSQLOrderByClause As String
    Dim dsDataSource As ADODB.Recordset

    strSELECTStatement = "Select fd_group.fdgp_desc From fd_group"

    If Not txtContainingText.Text = "" Then
    strSELECTStatement = strSELECTStatement & " WHERE fd_group.fdgp_desc LIKE '*" & txtContainingText.Text & "*'"
    End If

    Set dsDataSource = New ADODB.Recordset

    ' !!!!!! This open statement does not work.
    dsDataSource.Open strSELECTStatement, DataEnvironment1.dBConnect
    While Not (dsDataSource.EOF)

    << logic goes here >>


    Set dsDataSource = Nothing

    End Sub

  2. #2
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Homs, Syria


    Try replace the character '*' with '%'
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

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