I have a recordest that does not return any records. I know that it should return exactly one record. When i create the equivalent query in MS Access 2002 design view i get one record returned. The details:
VBA code:
Dim conA As Connection
Dim strConA As String
Dim rstSql2 as recordest
dim strSql2 as string
public sub match2()
set conA = new ADODB.connection
conA=currentproject.connection
strConA=conA.connectionString
Set rstSql2 = new ADODB.recordset
strSql2= "SELECT tblc.rnames,tblC.rNo FROM tblC WHERE "
strSql2=strSql2 & "tblC.rNames LIKE '*" & Trim(Left$(robbins, 4)) & "*';"
rstSql2.open strSql2, strConA, adOpenStatic
End Sub
In this Sub-routine 'trim(left$(robbins, 4)' results in the string "robb"
When the sub is run i get run time error '3021':
'Either BOF or EOF is true...'
However there should be one record returned because creating the equivalent query in design view returns one record containing the word "robbins". Why is the recordset not returning the record? Is there some syntax i have missed? Tearing my hair out with this one. Help please
VBA code:
Dim conA As Connection
Dim strConA As String
Dim rstSql2 as recordest
dim strSql2 as string
public sub match2()
set conA = new ADODB.connection
conA=currentproject.connection
strConA=conA.connectionString
Set rstSql2 = new ADODB.recordset
strSql2= "SELECT tblc.rnames,tblC.rNo FROM tblC WHERE "
strSql2=strSql2 & "tblC.rNames LIKE '*" & Trim(Left$(robbins, 4)) & "*';"
rstSql2.open strSql2, strConA, adOpenStatic
End Sub
In this Sub-routine 'trim(left$(robbins, 4)' results in the string "robb"
When the sub is run i get run time error '3021':
'Either BOF or EOF is true...'
However there should be one record returned because creating the equivalent query in design view returns one record containing the word "robbins". Why is the recordset not returning the record? Is there some syntax i have missed? Tearing my hair out with this one. Help please