Hello all,
I am using the following code to count records in an ADO recordset ;
Set rs = New ADODB.Recordset
rs.ActiveConnection = CurrentProject.Connection
rs.CursorType = adOpenKeyset
rs.Open sqlstring
If rs.recordCount = 0 Then
MsgBox "No matching retailers were found.", vbExclamation
rs.Close
Exit Sub
Else
This works perfectly with the following sqlstring ;
sqlstring = "select [Urn] from tblretailers;"
but when I use the LIKE operator, e.g.
sqlstring = "select [Urn] from tblretailers where [URN] like '9501*'"
it always returns ZERO. !! Can anyone point out what I am doing wrong ?
Thanks,
StepOne
I am using the following code to count records in an ADO recordset ;
Set rs = New ADODB.Recordset
rs.ActiveConnection = CurrentProject.Connection
rs.CursorType = adOpenKeyset
rs.Open sqlstring
If rs.recordCount = 0 Then
MsgBox "No matching retailers were found.", vbExclamation
rs.Close
Exit Sub
Else
This works perfectly with the following sqlstring ;
sqlstring = "select [Urn] from tblretailers;"
but when I use the LIKE operator, e.g.
sqlstring = "select [Urn] from tblretailers where [URN] like '9501*'"
it always returns ZERO. !! Can anyone point out what I am doing wrong ?
Thanks,
StepOne