I have the following function written. When I run the query that results from the SQL string (which I print in the debug window) in a query window I get rows returned. However the function always returns no rows found. Any ideas?
Public Function fCheckTZehut(txtZehut As String) As Boolean
Dim txtSql1 As String
Dim txtSql2 As String
Dim txtSql3 As String
Dim txtsqlFull As String
Dim bResult As Boolean
Dim rst As ADODB.Recordset
Dim cnn As Connection
Set cnn = CurrentProject.Connection
txtSql1 = “SELECT tblKever.intZehut FROM tblKever WHERE (((tblKever.intZehut) Like “”*”
txtSql2 = txtZehut
txtSql3 = “*””));”
txtsqlFull = txtSql1 & txtSql2 & txtSql3
Debug.Print txtsqlFull
Set rst = New ADODB.Recordset
rst.CursorType = adOpenStatic
rst.ActiveConnection = cnn
rst.Open txtsqlFull
If Not rst.BOF And Not rst.EOF Then
Debug.Print rst.RecordCount
bResult = True
Else
bResult = False
Debug.Print rst.RecordCount
End If
fCheckTZehut = bResult
Thanks