这样写有问题吗?谢谢~~!
If Adodc4.Recordset.RecordCount > 0 Then '若记录非空
Adodc4.Recordset.Find "select * from 年检表 where 年检时间 between #" & Format(DTPicker1.Value, "yyyy-mm-dd") & "# and #" & Format(DTPicker2.Value, "yyyy-mm-dd") & "#"""
If Adodc4.Recordset.EOF = True Then
MsgBox "对不起,没找到您要查找的关键字,请确认输入无误后再继续查找!", vbExclamation, "提示"
Adodc4.Refresh
End If
End If
If Adodc4.Recordset.RecordCount > 0 Then '若记录非空
Adodc4.Recordset.Find "select * from 年检表 where 年检时间 between #" & Format(DTPicker1.Value, "yyyy-mm-dd") & "# and #" & Format(DTPicker2.Value, "yyyy-mm-dd") & "#"""
If Adodc4.Recordset.EOF = True Then
MsgBox "对不起,没找到您要查找的关键字,请确认输入无误后再继续查找!", vbExclamation, "提示"
Adodc4.Refresh
End If
End If
还是不行你就定义一个新的Recordset
如Dim rs as New ADODB.Recordset
Set rs=New ADODB.Recordset
rs.open"select * from 年检表 where 年检时间 between #" & CDate(DTPicker1.Value) & "# and #" & CDate(DTPicker2.Value) & "#""