Public Function GetRecordset(ByRef strSql As String, ByRef strErrMsg As String, ByRef rs As Recordset) As Boolean
  
  On Error GoTo ERR_CONN
  ConnectToDatabase
  Set rs = g_Conn.Execute(strSql) '执行strSql语句
  
  '根据是否出错,返回给调用者相应的信息
  If err.Number = 0 Then
    GetRecordset = True
  Else
'    strErrMsg = Err.Description
    GetRecordset = False
'    Call ErrStringShow(strErrMsg)
  End If
  
  Exit Function
  
ERR_CONN:
  ErrStringShow err.Source & err.Description
  
End Function
在上面的语句里,
如果
strSql="SELECT customers.customerID AS searchID, customers.customerName AS searchName
FROM customers
WHERE (((customers.customerID) Like '*01*'))"
则出来的Recordset.recordcount 总是为0如果
strSql="SELECT customers.customerID AS searchID, customers.customerName AS searchName
FROM customers"
则出来的Recordset.recordcount 不为0请各位师兄指点,谢谢!