A
Alberto Uttranadhie
Hi, everybody,
I have a 'strange' problem with a ADO recordset. Here are
my code lines:
Function MyFunction()
On Error GoTo Err_MyFunction
Dim rst As New ADODB.Recordset
Dim str As String
str = "SELECT * FROM tblMyTable WHERE MyField
LIKE '*Whatever*';"
rst.Open str, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
MsgBox rst.RecordCount
rst.Close
Exit_MyFunction:
Exit Function
Err_MyFunction:
MsgBox Err.Description
Resume Exit_MyFunction
End Function
When using LIKE operator --with or without asterisks--
rst.RecordCount is always zero. I have tried such string
in a query and it works perfectly, but when it runs as
shown only zero returns. On the other side, when using
numeric values and 'equal to' symbol ( = ) or '>' '<' it
works fine.
Am I doing something wrong?
As always, thanks in advance,
Alberto Uttranadhie (Spain)
I have a 'strange' problem with a ADO recordset. Here are
my code lines:
Function MyFunction()
On Error GoTo Err_MyFunction
Dim rst As New ADODB.Recordset
Dim str As String
str = "SELECT * FROM tblMyTable WHERE MyField
LIKE '*Whatever*';"
rst.Open str, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
MsgBox rst.RecordCount
rst.Close
Exit_MyFunction:
Exit Function
Err_MyFunction:
MsgBox Err.Description
Resume Exit_MyFunction
End Function
When using LIKE operator --with or without asterisks--
rst.RecordCount is always zero. I have tried such string
in a query and it works perfectly, but when it runs as
shown only zero returns. On the other side, when using
numeric values and 'equal to' symbol ( = ) or '>' '<' it
works fine.
Am I doing something wrong?
As always, thanks in advance,
Alberto Uttranadhie (Spain)