你可以先查找再处理,如
Dim fdr = DataTables("在职员工").Find(filter)
If fdr is Nothing Then
msgbox("没有数据")
return
Else
msgbox("继续执行代码")
End If