PDA

Click to See Complete Forum and Search --> : LIKE operator fails for ADODB open statement


Martin Suchta
Nov 6th, 2000, 06:37 PM
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.
Martin

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 >>

dsDataSource.MoveNext
Wend

Set dsDataSource = Nothing

End Sub

Feras
Nov 7th, 2000, 12:03 AM
Try replace the character '*' with '%'