[RESOLVED] Determine if Filter Returns nothing
How can I determine if the filter that I just created at run-time returns nothing. This is what I am trying however it seems to return the wrong recordcount and records. I am using VBA / Access 2002
VB Code:
SQL = "Name LIKE '* TODD *'"
'Determine if there are any records to show
Form_frmLocateSuboenaSubfrm.Filter = SQL
Form_frmLocateSuboenaSubfrm.FilterOn = True
Form_frmLocateSuboenaSubfrm.Requery
Dim Qry As Recordset
Set Qry = CurrentDb.OpenRecordset( Form_frmLocateSuboenaSubfrm.Filter)
'Set Qry = CurrentDb.OpenRecordset( Form_frmLocateSuboenaSubfrm.RecordSource)
If Qry.RecordCount = 0 Then
MsgBox("No Match Found!")
Else
Form_frmLocateSuboenaSubfrm.FilterOn = false
End If
However when I do this there should be 2 names with TODD, but the recordset shows 1 record, but the name is KIM.
Re: Determine if Filter Returns nothing
I figured it out, but incase anyone else wants to know I did it like the following..
VB Code:
Dim Rst As Recordset
Set Rst = Form_frmLocateSuboenaSubfrm.RecordsetClone
If Rst.RecordCount = 0 Then
'No Records Found
Call InfoBox("There were no matchs found!")
cmdClearSearch_Click
Else
Form_frmLocateSuboenaSubfrm.Requery
End If